diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-10-22 15:03:20 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-10-22 15:03:20 +0000 |
commit | f18de0779776e3ee49531b16eee4e549b683c6d0 (patch) | |
tree | 4d458a3090df44652aa83a4324eb726594c8279e /lib | |
parent | 253926237450347b6e07435ef33808648363575f (diff) |
Restore previous behaviour and allow
ASN1_{GENERALIZED,UTC,}TIME_set_string() to be called with a NULL pointer.
Found the hard way by @kinichiro on github.
ok beck@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/src/crypto/asn1/a_time_tm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libssl/src/crypto/asn1/a_time_tm.c b/lib/libssl/src/crypto/asn1/a_time_tm.c index 352b9159ee2..e5ef007bb9e 100644 --- a/lib/libssl/src/crypto/asn1/a_time_tm.c +++ b/lib/libssl/src/crypto/asn1/a_time_tm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_time_tm.c,v 1.6 2015/10/19 16:32:37 beck Exp $ */ +/* $OpenBSD: a_time_tm.c,v 1.7 2015/10/22 15:03:19 jsing Exp $ */ /* * Copyright (c) 2015 Bob Beck <beck@openbsd.org> * @@ -216,17 +216,22 @@ ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode) { int type; char *tmp; - + if ((type = asn1_time_parse(str, strlen(str), NULL, mode)) == -1) return (0); if (mode != 0 && mode != type) return (0); + + if (s == NULL) + return (1); + if ((tmp = strdup(str)) == NULL) return (0); free(s->data); s->data = tmp; s->length = strlen(tmp); s->type = type; + return (1); } |