diff options
author | thekuwayama <thekuwayama@gmail.com> | 2019-06-21 06:52:40 +0900 |
---|---|---|
committer | thekuwayama <thekuwayama@gmail.com> | 2019-06-21 19:35:08 +0900 |
commit | 7947b1fbfbfb16e0f5cf30e43d13beb94e22231f (patch) | |
tree | 7a7f7b16b56a26d8aac27292cea913d7cb0c7fde /ext | |
parent | acd4e089e848f4ea1dc034a690997b02ee0ccb8a (diff) | |
download | ruby-openssl-7947b1fbfbfb16e0f5cf30e43d13beb94e22231f.tar.gz |
add nil guard `OpenSSL::BN.new`
Diffstat (limited to 'ext')
-rw-r--r-- | ext/openssl/ossl_bn.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index 4666ce6c..cdd7b0ea 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -192,6 +192,10 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self) base = NUM2INT(bs); } + if (NIL_P(str)) { + ossl_raise(rb_eArgError, "invalid argument"); + } + if (RB_INTEGER_TYPE_P(str)) { GetBN(self, bn); integer_to_bnptr(str, bn); |