aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_asn1.c
diff options
context:
space:
mode:
authorLeon M. George <leon@georgemail.eu>2016-12-06 19:44:12 +0100
committerLeon M. George <leon@georgemail.eu>2016-12-09 19:39:32 +0100
commit25cebdabaf9fb4b048405f5f94394d4335590361 (patch)
tree7395fb4be40878e5daf03d3b8ecda8e4a035e05e /ext/openssl/ossl_asn1.c
parent4ff95439d0b13aac7b9b2e3674f0a6662c715ec6 (diff)
downloadruby-openssl-25cebdabaf9fb4b048405f5f94394d4335590361.tar.gz
asn1: handle GENERALIZEDTIME without seconds
Diffstat (limited to 'ext/openssl/ossl_asn1.c')
-rw-r--r--ext/openssl/ossl_asn1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index af8ae2a6..7ef010d2 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -47,8 +47,13 @@ asn1time_to_time(const ASN1_TIME *time)
}
break;
case V_ASN1_GENERALIZEDTIME:
- if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
- &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
+ count = sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ",
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
+ &tm.tm_sec);
+ if (count == 5) {
+ tm.tm_sec = 0;
+ }
+ else if (count != 6) {
ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" );
}
break;