mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
openssl: use StringValueCStr() where NUL-terminated string is expected
* ext/openssl/ossl_asn1.c, ext/openssl/ossl_bn.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_digest.c ext/openssl/ossl_engine.c, ext/openssl/ossl_ns_spki.c ext/openssl/ossl_pkcs12.c, ext/openssl/ossl_pkcs7.c ext/openssl/ossl_pkey.c, ext/openssl/ossl_pkey_ec.c ext/openssl/ossl_rand.c, ext/openssl/ossl_ssl.c ext/openssl/ossl_x509attr.c, ext/openssl/ossl_x509cert.c ext/openssl/ossl_x509ext.c, ext/openssl/ossl_x509store.c: Use StringValueCStr() where NUL-terminated string is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b9da060bd8
commit
582fa9cde9
17 changed files with 90 additions and 82 deletions
|
@ -100,19 +100,19 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self)
|
|||
PKCS12 *p12;
|
||||
|
||||
rb_scan_args(argc, argv, "46", &pass, &name, &pkey, &cert, &ca, &key_nid, &cert_nid, &key_iter, &mac_iter, &keytype);
|
||||
passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass);
|
||||
friendlyname = NIL_P(name) ? NULL : StringValuePtr(name);
|
||||
passphrase = NIL_P(pass) ? NULL : StringValueCStr(pass);
|
||||
friendlyname = NIL_P(name) ? NULL : StringValueCStr(name);
|
||||
key = GetPKeyPtr(pkey);
|
||||
x509 = GetX509CertPtr(cert);
|
||||
x509s = NIL_P(ca) ? NULL : ossl_x509_ary2sk(ca);
|
||||
/* TODO: make a VALUE to nid function */
|
||||
if (!NIL_P(key_nid)) {
|
||||
if ((nkey = OBJ_txt2nid(StringValuePtr(key_nid))) == NID_undef)
|
||||
ossl_raise(rb_eArgError, "Unknown PBE algorithm %s", StringValuePtr(key_nid));
|
||||
if ((nkey = OBJ_txt2nid(StringValueCStr(key_nid))) == NID_undef)
|
||||
ossl_raise(rb_eArgError, "Unknown PBE algorithm %"PRIsVALUE, key_nid);
|
||||
}
|
||||
if (!NIL_P(cert_nid)) {
|
||||
if ((ncert = OBJ_txt2nid(StringValuePtr(cert_nid))) == NID_undef)
|
||||
ossl_raise(rb_eArgError, "Unknown PBE algorithm %s", StringValuePtr(cert_nid));
|
||||
if ((ncert = OBJ_txt2nid(StringValueCStr(cert_nid))) == NID_undef)
|
||||
ossl_raise(rb_eArgError, "Unknown PBE algorithm %"PRIsVALUE, cert_nid);
|
||||
}
|
||||
if (!NIL_P(key_iter))
|
||||
kiter = NUM2INT(key_iter);
|
||||
|
@ -158,7 +158,7 @@ ossl_pkcs12_initialize(int argc, VALUE *argv, VALUE self)
|
|||
PKCS12 *pkcs = DATA_PTR(self);
|
||||
|
||||
if(rb_scan_args(argc, argv, "02", &arg, &pass) == 0) return self;
|
||||
passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass);
|
||||
passphrase = NIL_P(pass) ? NULL : StringValueCStr(pass);
|
||||
in = ossl_obj2bio(arg);
|
||||
d2i_PKCS12_bio(in, &pkcs);
|
||||
DATA_PTR(self) = pkcs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue