diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-18 11:46:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-18 11:46:04 +0000 |
commit | 6a8d00496a543a2c2489d564cec85effed670107 (patch) | |
tree | 887222063fc1a112f0a9766c4f78fcdb6359ff37 /ext/openssl | |
parent | 549e0e488eba4c7710cf5b63d6e319415244bf60 (diff) | |
download | ruby-6a8d00496a543a2c2489d564cec85effed670107.tar.gz |
ossl_x509name.c: null-terminate field name
* ext/openssl/ossl_x509name.c (ossl_x509name_add_entry): field
name of X509_NAME_add_entry_by_txt() must be NULL-terminated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/ossl_x509name.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index 6de79d45e9..be70dc1b12 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -183,13 +183,14 @@ VALUE ossl_x509name_add_entry(int argc, VALUE *argv, VALUE self) { X509_NAME *name; VALUE oid, value, type; + const char *oid_name; rb_scan_args(argc, argv, "21", &oid, &value, &type); - StringValue(oid); + oid_name = StringValueCStr(oid); StringValue(value); if(NIL_P(type)) type = rb_aref(OBJECT_TYPE_TEMPLATE, oid); GetX509Name(self, name); - if (!X509_NAME_add_entry_by_txt(name, RSTRING_PTR(oid), NUM2INT(type), + if (!X509_NAME_add_entry_by_txt(name, oid_name, NUM2INT(type), (const unsigned char *)RSTRING_PTR(value), RSTRING_LENINT(value), -1, 0)) { ossl_raise(eX509NameError, NULL); } |