diff options
| author | miod <> | 2014-05-18 19:35:04 +0000 |
|---|---|---|
| committer | miod <> | 2014-05-18 19:35:04 +0000 |
| commit | 1e36ca8be6d0eadaade75d690ef217539cdf2c54 (patch) | |
| tree | cdc617af7478edf94a172ec79d4d1e5bd9546cb3 /src/lib/libcrypto/asn1/f_string.c | |
| parent | 22a6d08ee6c69b4a77350b5ac129544665b576ec (diff) | |
| download | openbsd-1e36ca8be6d0eadaade75d690ef217539cdf2c54.tar.gz openbsd-1e36ca8be6d0eadaade75d690ef217539cdf2c54.tar.bz2 openbsd-1e36ca8be6d0eadaade75d690ef217539cdf2c54.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_string.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/f_string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c index 0a1f136b4e..163fca08c1 100644 --- a/src/lib/libcrypto/asn1/f_string.c +++ b/src/lib/libcrypto/asn1/f_string.c | |||
| @@ -150,14 +150,14 @@ a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) | |||
| 150 | } | 150 | } |
| 151 | i /= 2; | 151 | i /= 2; |
| 152 | if (num + i > slen) { | 152 | if (num + i > slen) { |
| 153 | sp = realloc(s, (unsigned int)num + i * 2); | 153 | sp = realloc(s, (unsigned int)num + i); |
| 154 | if (sp == NULL) { | 154 | if (sp == NULL) { |
| 155 | ASN1err(ASN1_F_A2I_ASN1_STRING, | 155 | ASN1err(ASN1_F_A2I_ASN1_STRING, |
| 156 | ERR_R_MALLOC_FAILURE); | 156 | ERR_R_MALLOC_FAILURE); |
| 157 | goto err; | 157 | goto err; |
| 158 | } | 158 | } |
| 159 | s = sp; | 159 | s = sp; |
| 160 | slen = num + i * 2; | 160 | slen = num + i; |
| 161 | } | 161 | } |
| 162 | for (j = 0; j < i; j++, k += 2) { | 162 | for (j = 0; j < i; j++, k += 2) { |
| 163 | for (n = 0; n < 2; n++) { | 163 | for (n = 0; n < 2; n++) { |
