[ruby/openssl] ns_spki: fix exception class in OpenSSL::Netscape::SPKI#to_der
It should raise OpenSSL::Netscape::SPKIError instead of OpenSSL::X509::CertificateError. No test cases covered this because it only occurs in exceptional cases, such as memory allocation failure. https://github.com/ruby/openssl/commit/527b6101d1
This commit is contained in:
parent
b207b956c1
commit
3656c1db29
@ -115,11 +115,11 @@ ossl_spki_to_der(VALUE self)
|
|||||||
|
|
||||||
GetSPKI(self, spki);
|
GetSPKI(self, spki);
|
||||||
if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0)
|
if ((len = i2d_NETSCAPE_SPKI(spki, NULL)) <= 0)
|
||||||
ossl_raise(eX509CertError, NULL);
|
ossl_raise(eSPKIError, "i2d_NETSCAPE_SPKI");
|
||||||
str = rb_str_new(0, len);
|
str = rb_str_new(0, len);
|
||||||
p = (unsigned char *)RSTRING_PTR(str);
|
p = (unsigned char *)RSTRING_PTR(str);
|
||||||
if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
|
if (i2d_NETSCAPE_SPKI(spki, &p) <= 0)
|
||||||
ossl_raise(eX509CertError, NULL);
|
ossl_raise(eSPKIError, "i2d_NETSCAPE_SPKI");
|
||||||
ossl_str_adjust(str, p);
|
ossl_str_adjust(str, p);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user