diff options
Diffstat (limited to 'src/lib/libssl')
| -rw-r--r-- | src/lib/libssl/src/crypto/asn1/a_time.c | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/src/lib/libssl/src/crypto/asn1/a_time.c b/src/lib/libssl/src/crypto/asn1/a_time.c index 29d56b827a..080c3dfddb 100644 --- a/src/lib/libssl/src/crypto/asn1/a_time.c +++ b/src/lib/libssl/src/crypto/asn1/a_time.c | |||
| @@ -126,6 +126,7 @@ ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) | |||
| 126 | ASN1_GENERALIZEDTIME *ret; | 126 | ASN1_GENERALIZEDTIME *ret; | 
| 127 | char *str; | 127 | char *str; | 
| 128 | int newlen; | 128 | int newlen; | 
| 129 | int i; | ||
| 129 | 130 | ||
| 130 | if (!ASN1_TIME_check(t)) | 131 | if (!ASN1_TIME_check(t)) | 
| 131 | return NULL; | 132 | return NULL; | 
| @@ -151,13 +152,12 @@ ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) | |||
| 151 | /* ASN1_STRING_set() allocated 'len + 1' bytes. */ | 152 | /* ASN1_STRING_set() allocated 'len + 1' bytes. */ | 
| 152 | newlen = t->length + 2 + 1; | 153 | newlen = t->length + 2 + 1; | 
| 153 | str = (char *)ret->data; | 154 | str = (char *)ret->data; | 
| 154 | /* Work out the century and prepend */ | 155 | i = snprintf(str, newlen, "%s%s", (t->data >= '5') ? "19" : "20", | 
| 155 | if (t->data[0] >= '5') | 156 | (char *) t->data); | 
| 156 | strlcpy(str, "19", newlen); | 157 | if (i == -1 || i >= newlen) { | 
| 157 | else | 158 | ASN1_STRING_free(ret); | 
| 158 | strlcpy(str, "20", newlen); | 159 | return NULL; | 
| 159 | strlcat(str, (char *)t->data, newlen); | 160 | } | 
| 160 | |||
| 161 | return ret; | 161 | return ret; | 
| 162 | } | 162 | } | 
| 163 | 163 | ||
