diff options
Diffstat (limited to 'crypto/asn1/a_gentm.c')
-rw-r--r-- | crypto/asn1/a_gentm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 2c5fb1c3d2..5cfc3ff15e 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -207,7 +207,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, char *p; struct tm *ts; struct tm data; - size_t len = 20; + const size_t len = 20; ASN1_GENERALIZEDTIME *tmps = NULL; if (s == NULL) @@ -237,10 +237,10 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, tmps->data = (unsigned char *)p; } - sprintf(p, "%04d%02d%02d%02d%02d%02dZ", ts->tm_year + 1900, - ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, - ts->tm_sec); - tmps->length = strlen(p); + tmps->length = BIO_snprintf(p, len, "%04d%02d%02d%02d%02d%02dZ", + ts->tm_year + 1900, ts->tm_mon + 1, + ts->tm_mday, ts->tm_hour, ts->tm_min, + ts->tm_sec); tmps->type = V_ASN1_GENERALIZEDTIME; #ifdef CHARSET_EBCDIC_not ebcdic2ascii(tmps->data, tmps->data, tmps->length); |