diff options
author | 2014-05-18 19:35:04 +0000 | |
---|---|---|
committer | 2014-05-18 19:35:04 +0000 | |
commit | 89e34462d6c789038010ea62344815cd8fa9f3c1 (patch) | |
tree | db58e93771352ebbb75c7d416802f0ac452890a7 /lib/libssl/src/crypto/asn1/f_string.c | |
parent | Make sure UTF8_getc() is invoked with the proper buffer size. (diff) | |
download | wireguard-openbsd-89e34462d6c789038010ea62344815cd8fa9f3c1.tar.xz wireguard-openbsd-89e34462d6c789038010ea62344815cd8fa9f3c1.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 'lib/libssl/src/crypto/asn1/f_string.c')
-rw-r--r-- | lib/libssl/src/crypto/asn1/f_string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libssl/src/crypto/asn1/f_string.c b/lib/libssl/src/crypto/asn1/f_string.c index 0a1f136b4e7..163fca08c1d 100644 --- a/lib/libssl/src/crypto/asn1/f_string.c +++ b/lib/libssl/src/crypto/asn1/f_string.c @@ -150,14 +150,14 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) } i /= 2; if (num + i > slen) { - sp = realloc(s, (unsigned int)num + i * 2); + sp = realloc(s, (unsigned int)num + i); if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE); goto err; } s = sp; - slen = num + i * 2; + slen = num + i; } for (j = 0; j < i; j++, k += 2) { for (n = 0; n < 2; n++) { |