diff options
author | ho <> | 2003-04-03 17:56:27 +0000 |
---|---|---|
committer | ho <> | 2003-04-03 17:56:27 +0000 |
commit | bb3ab39eadbb997785927b2f22f09cde22fdf9ff (patch) | |
tree | b885062cf6f2739801505405e53a4f0aaee07c33 /src | |
parent | 6bb2106b98eb0674d6726bb6917cea8c27ed9d81 (diff) | |
download | openbsd-bb3ab39eadbb997785927b2f22f09cde22fdf9ff.tar.gz openbsd-bb3ab39eadbb997785927b2f22f09cde22fdf9ff.tar.bz2 openbsd-bb3ab39eadbb997785927b2f22f09cde22fdf9ff.zip |
Correct off-by-one error in previous commit. millert@ ok.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/asn1/a_time.c | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/asn1/a_time.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c index f8fdfb5975..8216783aa8 100644 --- a/src/lib/libcrypto/asn1/a_time.c +++ b/src/lib/libcrypto/asn1/a_time.c | |||
@@ -146,9 +146,10 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE | |||
146 | } | 146 | } |
147 | 147 | ||
148 | /* grow the string */ | 148 | /* grow the string */ |
149 | newlen = t->length + 2; | 149 | if (!ASN1_STRING_set(ret, NULL, t->length + 2)) |
150 | if (!ASN1_STRING_set(ret, NULL, newlen)) | ||
151 | return NULL; | 150 | return NULL; |
151 | /* ASN1_STRING_set() allocated 'len + 1' bytes. */ | ||
152 | newlen = t->length + 2 + 1; | ||
152 | str = (char *)ret->data; | 153 | str = (char *)ret->data; |
153 | /* Work out the century and prepend */ | 154 | /* Work out the century and prepend */ |
154 | if (t->data[0] >= '5') strlcpy(str, "19", newlen); | 155 | if (t->data[0] >= '5') strlcpy(str, "19", newlen); |
diff --git a/src/lib/libssl/src/crypto/asn1/a_time.c b/src/lib/libssl/src/crypto/asn1/a_time.c index f8fdfb5975..8216783aa8 100644 --- a/src/lib/libssl/src/crypto/asn1/a_time.c +++ b/src/lib/libssl/src/crypto/asn1/a_time.c | |||
@@ -146,9 +146,10 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE | |||
146 | } | 146 | } |
147 | 147 | ||
148 | /* grow the string */ | 148 | /* grow the string */ |
149 | newlen = t->length + 2; | 149 | if (!ASN1_STRING_set(ret, NULL, t->length + 2)) |
150 | if (!ASN1_STRING_set(ret, NULL, newlen)) | ||
151 | return NULL; | 150 | return NULL; |
151 | /* ASN1_STRING_set() allocated 'len + 1' bytes. */ | ||
152 | newlen = t->length + 2 + 1; | ||
152 | str = (char *)ret->data; | 153 | str = (char *)ret->data; |
153 | /* Work out the century and prepend */ | 154 | /* Work out the century and prepend */ |
154 | if (t->data[0] >= '5') strlcpy(str, "19", newlen); | 155 | if (t->data[0] >= '5') strlcpy(str, "19", newlen); |