diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-21 18:38:43 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-27 23:07:41 +0900 |
commit | 435fe7bdd0980e3fdb5483986a784fa2ba4bc46a (patch) | |
tree | 43c3b271d08810d9a253a295e79cf121e4abf1de /ext/openssl/ossl_asn1.c | |
parent | 4c726635566caf0772f253baeb7b1b86b1711c8f (diff) | |
download | ruby-435fe7bdd0980e3fdb5483986a784fa2ba4bc46a.tar.gz |
ext/openssl: d2i_ASN1_BOOLEAN is removed
Diffstat (limited to 'ext/openssl/ossl_asn1.c')
-rw-r--r-- | ext/openssl/ossl_asn1.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index ed715097d4..2867f64ec1 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -330,14 +330,15 @@ obj_to_asn1derstr(VALUE obj) static VALUE decode_bool(unsigned char* der, long length) { - int val; - const unsigned char *p; + const unsigned char *p = der; - p = der; - if((val = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0) - ossl_raise(eASN1Error, NULL); + assert(length == 3); + if (*p++ != 1) + ossl_raise(eASN1Error, "not boolean"); + if (*p++ != 1) + ossl_raise(eASN1Error, "length is not 1"); - return val ? Qtrue : Qfalse; + return *p ? Qtrue : Qfalse; } static VALUE |