summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_int.c
diff options
context:
space:
mode:
authormiod <>2014-05-18 19:35:04 +0000
committermiod <>2014-05-18 19:35:04 +0000
commit68e33037c2e3ee88c2f07e6259cb0ec3c5a5e54f (patch)
treecdc617af7478edf94a172ec79d4d1e5bd9546cb3 /src/lib/libcrypto/asn1/f_int.c
parent085e31a6cf677e0452c0ba970c49088ace77d564 (diff)
downloadopenbsd-68e33037c2e3ee88c2f07e6259cb0ec3c5a5e54f.tar.gz
openbsd-68e33037c2e3ee88c2f07e6259cb0ec3c5a5e54f.tar.bz2
openbsd-68e33037c2e3ee88c2f07e6259cb0ec3c5a5e54f.zip
If you need to allocate `a + b' bytes of memory, then don't allocate `a + b*2',
this is confusing and unnecessary. Help (coz I got confused) and ok guenther@ beck@
Diffstat (limited to 'src/lib/libcrypto/asn1/f_int.c')
-rw-r--r--src/lib/libcrypto/asn1/f_int.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index 283860d72d..192e2f374f 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -158,14 +158,14 @@ a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
158 } 158 }
159 i /= 2; 159 i /= 2;
160 if (num + i > slen) { 160 if (num + i > slen) {
161 sp = OPENSSL_realloc_clean(s, slen, num + i * 2); 161 sp = OPENSSL_realloc_clean(s, slen, num + i);
162 if (sp == NULL) { 162 if (sp == NULL) {
163 ASN1err(ASN1_F_A2I_ASN1_INTEGER, 163 ASN1err(ASN1_F_A2I_ASN1_INTEGER,
164 ERR_R_MALLOC_FAILURE); 164 ERR_R_MALLOC_FAILURE);
165 goto err; 165 goto err;
166 } 166 }
167 s = sp; 167 s = sp;
168 slen = num + i * 2; 168 slen = num + i;
169 } 169 }
170 for (j = 0; j < i; j++, k += 2) { 170 for (j = 0; j < i; j++, k += 2) {
171 for (n = 0; n < 2; n++) { 171 for (n = 0; n < 2; n++) {