diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-12-12 20:40:36 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-07-23 13:32:35 +0900 |
commit | f61af664ecf4fd74ef0adc1138bc09455e89199f (patch) | |
tree | ebfdf069e93dd582d12d4951e26845a755822177 /ext/openssl/ossl_x509crl.c | |
parent | e61502fb82084937160f4ffa0bda89f4c6788d6d (diff) | |
download | ruby-openssl-f61af664ecf4fd74ef0adc1138bc09455e89199f.tar.gz |
asn1: disallow NULL to be passed to asn1time_to_time()
Let the callers check the validity of the ASN1_TIME.
Diffstat (limited to 'ext/openssl/ossl_x509crl.c')
-rw-r--r-- | ext/openssl/ossl_x509crl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index 3f1b76c0..d6b588fc 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -208,10 +208,14 @@ static VALUE ossl_x509crl_get_last_update(VALUE self) { X509_CRL *crl; + const ASN1_TIME *time; GetX509CRL(self, crl); + time = X509_CRL_get0_lastUpdate(crl); + if (!time) + return Qnil; - return asn1time_to_time(X509_CRL_get0_lastUpdate(crl)); + return asn1time_to_time(time); } static VALUE @@ -235,10 +239,14 @@ static VALUE ossl_x509crl_get_next_update(VALUE self) { X509_CRL *crl; + const ASN1_TIME *time; GetX509CRL(self, crl); + time = X509_CRL_get0_nextUpdate(crl); + if (!time) + return Qnil; - return asn1time_to_time(X509_CRL_get0_nextUpdate(crl)); + return asn1time_to_time(time); } static VALUE |