diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2017-07-06 09:21:36 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-07-11 13:20:24 +0900 |
commit | 3af2635f117f8da563d180bc1c58702aecb16e0c (patch) | |
tree | 14e6b96336f2aa7afbc4411c0beccd5ffa48bbda /ext/openssl/ossl_pkey.c | |
parent | 261353a42d0dc0e7bf73e5a8fb8ecffd04249d42 (diff) | |
download | ruby-openssl-3af2635f117f8da563d180bc1c58702aecb16e0c.tar.gz |
bio: prevent possible GC issue in ossl_obj2bio()
Prevent the new object created by StringValue() from being GCed.
Luckily, as none of the callers of ossl_obj2bio() reads from the
returned BIO after possible triggering GC, this has not been a real
problem.
As a bonus, ossl_protect_obj2bio() function which is no longer used
anywhere is removed.
Diffstat (limited to 'ext/openssl/ossl_pkey.c')
-rw-r--r-- | ext/openssl/ossl_pkey.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 6ab1b618..314d1d94 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -144,7 +144,7 @@ ossl_pkey_new_from_data(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "11", &data, &pass); pass = ossl_pem_passwd_value(pass); - bio = ossl_obj2bio(data); + bio = ossl_obj2bio(&data); if (!(pkey = d2i_PrivateKey_bio(bio, NULL))) { OSSL_BIO_reset(bio); if (!(pkey = PEM_read_bio_PrivateKey(bio, NULL, ossl_pem_passwd_cb, (void *)pass))) { |