diff options
author | Richard Levitte <levitte@openssl.org> | 2004-01-19 08:53:02 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2004-01-19 08:53:02 +0000 |
commit | 8b79f2051d831eb7cb51205b27661d43e3cf3f5e (patch) | |
tree | fca871353fec9cdc5c0c644580a7007d1f67ca26 /crypto/asn1/a_time.c | |
parent | 799562704032021e111a998c0a2e286e7b405a28 (diff) |
Recent and not so recent changes from 0.9.7-stable, all conflicts resolved.
Diffstat (limited to 'crypto/asn1/a_time.c')
-rw-r--r-- | crypto/asn1/a_time.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index 1b51a0752e..b613faf1a0 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -129,6 +129,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, { ASN1_GENERALIZEDTIME *ret; char *str; + int newlen; if (!ASN1_TIME_check(t)) return NULL; @@ -151,12 +152,14 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, /* grow the string */ 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') strcpy(str, "19"); - else strcpy(str, "20"); + if (t->data[0] >= '5') BUF_strlcpy(str, "19", newlen); + else BUF_strlcpy(str, "20", newlen); - BUF_strlcat(str, (char *)t->data, t->length+3); /* Include space for a '\0' */ + BUF_strlcat(str, (char *)t->data, newlen); return ret; } |