diff options
author | Rich Salz <rsalz@openssl.org> | 2017-06-14 20:34:37 -0400 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2017-07-05 11:32:35 +1000 |
commit | 0904e79a6e6109240d5a552f2699408b26cf63ee (patch) | |
tree | df0b4928a751b05779164cf7dd84265407bea332 /crypto/asn1/a_time.c | |
parent | ff281ee8369350d88e8b57af139614f5683e1e8c (diff) |
Undo commit d420ac2
[extended tests]
Original text:
Use BUF_strlcpy() instead of strcpy().
Use BUF_strlcat() instead of strcat().
Use BIO_snprintf() instead of sprintf().
In some cases, keep better track of buffer lengths.
This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/3701)
Diffstat (limited to 'crypto/asn1/a_time.c')
-rw-r--r-- | crypto/asn1/a_time.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index 12b1ff5890..f0ec42f71c 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -64,7 +64,6 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, { ASN1_GENERALIZEDTIME *ret = NULL; char *str; - int newlen; if (!ASN1_TIME_check(t)) return NULL; @@ -85,16 +84,14 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, /* grow the string */ if (!ASN1_STRING_set(ret, NULL, t->length + 2)) goto err; - /* 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') - OPENSSL_strlcpy(str, "19", newlen); + strcpy(str, "19"); else - OPENSSL_strlcpy(str, "20", newlen); + strcpy(str, "20"); - OPENSSL_strlcat(str, (const char *)t->data, newlen); + strcat(str, (const char *)t->data); done: if (out != NULL && *out == NULL) |