diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-01 23:10:31 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-04 15:00:13 -0400 |
commit | b4faea50c35d92a67d1369355b49cc3efba78406 (patch) | |
tree | cfebea69d625f936c9fd7281f1fa3eaa2fa38834 /crypto/bn/Makefile | |
parent | 8920a7cd04f43b1a090d0b0a8c9e16b94c6898d4 (diff) |
Use safer sizeof variant in malloc
For a local variable:
TYPE *p;
Allocations like this are "risky":
p = OPENSSL_malloc(sizeof(TYPE));
if the type of p changes, and the malloc call isn't updated, you
could get memory corruption. Instead do this:
p = OPENSSL_malloc(sizeof(*p));
Also fixed a few memset() calls that I noticed while doing this.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bn/Makefile')
-rw-r--r-- | crypto/bn/Makefile | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/bn/Makefile b/crypto/bn/Makefile index 5b45f11851..2bae4abd8d 100644 --- a/crypto/bn/Makefile +++ b/crypto/bn/Makefile @@ -215,7 +215,7 @@ bn_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h bn_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h bn_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h bn_depr.o: ../cryptlib.h ../include/internal/bn_int.h bn_depr.c bn_lcl.h -bn_dh.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h +bn_dh.o: ../../e_os.h ../../include/openssl/bn.h ../../include/openssl/crypto.h bn_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h bn_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h bn_dh.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h @@ -391,12 +391,12 @@ bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h bn_sqrt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h bn_sqrt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_sqrt.o: ../include/internal/bn_int.h bn_lcl.h bn_sqrt.c -bn_srp.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h -bn_srp.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h -bn_srp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h -bn_srp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -bn_srp.o: ../../include/openssl/symhacks.h ../include/internal/bn_int.h -bn_srp.o: bn_lcl.h bn_srp.c +bn_srp.o: ../../e_os.h ../../include/openssl/bn.h +bn_srp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h +bn_srp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h +bn_srp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h +bn_srp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h +bn_srp.o: ../include/internal/bn_int.h bn_lcl.h bn_srp.c bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h |