summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
authorho <ho@openbsd.org>2003-04-03 17:56:27 +0000
committerho <ho@openbsd.org>2003-04-03 17:56:27 +0000
commit08ddf539daf36a3180bee23e88386690703ae336 (patch)
treea2e1fc711f94f70e8ee700b173f0b24bf151c110 /lib/libssl/src
parentUse snprintf() and strlcpy() throughout. (diff)
downloadwireguard-openbsd-08ddf539daf36a3180bee23e88386690703ae336.tar.xz
wireguard-openbsd-08ddf539daf36a3180bee23e88386690703ae336.zip
Correct off-by-one error in previous commit. millert@ ok.
Diffstat (limited to 'lib/libssl/src')
-rw-r--r--lib/libssl/src/crypto/asn1/a_time.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libssl/src/crypto/asn1/a_time.c b/lib/libssl/src/crypto/asn1/a_time.c
index f8fdfb5975e..8216783aa8f 100644
--- a/lib/libssl/src/crypto/asn1/a_time.c
+++ b/lib/libssl/src/crypto/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);