summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/srp/srp_lib.c
diff options
context:
space:
mode:
authorderaadt <>2014-05-29 21:07:43 +0000
committerderaadt <>2014-05-29 21:07:43 +0000
commit3d662abca6b2a7f5bc9108b036434d61fcdb6e53 (patch)
treed5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/srp/srp_lib.c
parentd205a2aecb99564cccfbea61c39ebe3b0ddd7fb7 (diff)
downloadopenbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.gz
openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.tar.bz2
openbsd-3d662abca6b2a7f5bc9108b036434d61fcdb6e53.zip
convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53
potential integer overflows easily changed into an allocation return of NULL, with errno nicely set if need be. checks for an allocations returning NULL are commonplace, or if the object is dereferenced (quite normal) will result in a nice fault which can be detected & repaired properly. ok tedu
Diffstat (limited to 'src/lib/libcrypto/srp/srp_lib.c')
-rw-r--r--src/lib/libcrypto/srp/srp_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/libcrypto/srp/srp_lib.c b/src/lib/libcrypto/srp/srp_lib.c
index a3a67eda2e..77e2c2c2f2 100644
--- a/src/lib/libcrypto/srp/srp_lib.c
+++ b/src/lib/libcrypto/srp/srp_lib.c
@@ -121,7 +121,7 @@ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N)
121 121
122 longN= BN_num_bytes(N); 122 longN= BN_num_bytes(N);
123 123
124 if ((cAB = malloc(2*longN)) == NULL) 124 if ((cAB = reallocarray(NULL, 2, longN)) == NULL)
125 return NULL; 125 return NULL;
126 126
127 memset(cAB, 0, longN); 127 memset(cAB, 0, longN);