diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-12-18 21:47:20 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-01-20 15:55:58 +0100 |
commit | b09aa550d3d9af269f9551a5a95a3d8408d9098d (patch) | |
tree | 7cfcb3e10b4ee022e7dae8d0bb4242180cfc3bd3 /crypto/asn1/a_time.c | |
parent | 9495cfbc22393aee87aa877e9e2e726c2cc441f1 (diff) |
ASN1_TIME_print() etc.: Improve doc and add comment on handling invalid time input
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13714)
Diffstat (limited to 'crypto/asn1/a_time.c')
-rw-r--r-- | crypto/asn1/a_time.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index c34b028eaf..7bd97c6598 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -476,7 +476,9 @@ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) if (!asn1_time_to_tm(&stm, tm)) { /* asn1_time_to_tm will check the time type */ - goto err; + (void)BIO_write(bp, "Bad time value", 14); + return 0; + /* It would have been more consistent to return BIO_write(...) */ } l = tm->length; @@ -509,9 +511,6 @@ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) stm.tm_min, stm.tm_sec, stm.tm_year + 1900, (gmt ? " GMT" : "")) > 0; } - err: - BIO_write(bp, "Bad time value", 14); - return 0; } int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t) |