mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
549e0e488e
commit
6a8d00496a
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue