summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_enum.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_enum.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_enum.c')
-rw-r--r--src/lib/libcrypto/asn1/f_enum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/f_enum.c b/src/lib/libcrypto/asn1/f_enum.c
index c7b81ccbc9..14b609ebc8 100644
--- a/src/lib/libcrypto/asn1/f_enum.c
+++ b/src/lib/libcrypto/asn1/f_enum.c
@@ -154,14 +154,14 @@ a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
154 } 154 }
155 i /= 2; 155 i /= 2;
156 if (num + i > slen) { 156 if (num + i > slen) {
157 sp = realloc(s, (unsigned int)num + i * 2); 157 sp = realloc(s, (unsigned int)num + i);
158 if (sp == NULL) { 158 if (sp == NULL) {
159 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, 159 ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,
160 ERR_R_MALLOC_FAILURE); 160 ERR_R_MALLOC_FAILURE);
161 goto err; 161 goto err;
162 } 162 }
163 s = sp; 163 s = sp;
164 slen = num + i * 2; 164 slen = num + i;
165 } 165 }
166 for (j = 0; j < i; j++, k += 2) { 166 for (j = 0; j < i; j++, k += 2) {
167 for (n = 0; n < 2; n++) { 167 for (n = 0; n < 2; n++) {