From bb3ab39eadbb997785927b2f22f09cde22fdf9ff Mon Sep 17 00:00:00 2001 From: ho <> Date: Thu, 3 Apr 2003 17:56:27 +0000 Subject: Correct off-by-one error in previous commit. millert@ ok. --- src/lib/libcrypto/asn1/a_time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib/libcrypto') diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c index f8fdfb5975..8216783aa8 100644 --- a/src/lib/libcrypto/asn1/a_time.c +++ b/src/lib/libcrypto/asn1/a_time.c @@ -146,9 +146,10 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE } /* grow the string */ - newlen = t->length + 2; - if (!ASN1_STRING_set(ret, NULL, newlen)) + if (!ASN1_STRING_set(ret, NULL, t->length + 2)) return NULL; + /* ASN1_STRING_set() allocated 'len + 1' bytes. */ + newlen = t->length + 2 + 1; str = (char *)ret->data; /* Work out the century and prepend */ if (t->data[0] >= '5') strlcpy(str, "19", newlen); -- cgit v1.2.3-55-g6feb