From c17368782332d5390bfaad4469867db6c79abf1e Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 22 Oct 2015 15:38:05 +0000 Subject: [PATCH] Another change that is needed to restore the previous behaviour of ASN1_{GENERALIZED,UTC}TIME_set_string(), which allows it to be called with a NULL pointer. ok beck@ --- lib/libcrypto/asn1/a_time_tm.c | 8 +++----- lib/libssl/src/crypto/asn1/a_time_tm.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/libcrypto/asn1/a_time_tm.c b/lib/libcrypto/asn1/a_time_tm.c index e5ef007bb9e..65de0d4f180 100644 --- a/lib/libcrypto/asn1/a_time_tm.c +++ b/lib/libcrypto/asn1/a_time_tm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_time_tm.c,v 1.7 2015/10/22 15:03:19 jsing Exp $ */ +/* $OpenBSD: a_time_tm.c,v 1.8 2015/10/22 15:38:05 jsing Exp $ */ /* * Copyright (c) 2015 Bob Beck * @@ -369,7 +369,7 @@ ASN1_UTCTIME_check(ASN1_UTCTIME *d) int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) { - if (s->type != V_ASN1_UTCTIME) + if (s != NULL && s->type != V_ASN1_UTCTIME) return (0); return (ASN1_TIME_set_string_internal(s, str, V_ASN1_UTCTIME)); } @@ -425,7 +425,7 @@ ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) { - if (s->type != V_ASN1_GENERALIZEDTIME) + if (s != NULL && s->type != V_ASN1_GENERALIZEDTIME) return (0); return (ASN1_TIME_set_string_internal(s, str, V_ASN1_GENERALIZEDTIME)); } @@ -443,5 +443,3 @@ ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, V_ASN1_GENERALIZEDTIME)); } - - diff --git a/lib/libssl/src/crypto/asn1/a_time_tm.c b/lib/libssl/src/crypto/asn1/a_time_tm.c index e5ef007bb9e..65de0d4f180 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.7 2015/10/22 15:03:19 jsing Exp $ */ +/* $OpenBSD: a_time_tm.c,v 1.8 2015/10/22 15:38:05 jsing Exp $ */ /* * Copyright (c) 2015 Bob Beck * @@ -369,7 +369,7 @@ ASN1_UTCTIME_check(ASN1_UTCTIME *d) int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) { - if (s->type != V_ASN1_UTCTIME) + if (s != NULL && s->type != V_ASN1_UTCTIME) return (0); return (ASN1_TIME_set_string_internal(s, str, V_ASN1_UTCTIME)); } @@ -425,7 +425,7 @@ ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) { - if (s->type != V_ASN1_GENERALIZEDTIME) + if (s != NULL && s->type != V_ASN1_GENERALIZEDTIME) return (0); return (ASN1_TIME_set_string_internal(s, str, V_ASN1_GENERALIZEDTIME)); } @@ -443,5 +443,3 @@ ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, time_t t, int offset_day, return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, V_ASN1_GENERALIZEDTIME)); } - - -- 2.20.1