[ruby/openssl] x509: do not check for negative return from X509_*_get_ext_count()
These functions wrap X509v3_get_ext_count(). The implementation can never return a negative number, and this behavior is documented in the man page. https://github.com/ruby/openssl/commit/5164725855
This commit is contained in:
parent
8888ad6902
commit
47cdf98fa4
@ -619,10 +619,7 @@ ossl_x509_get_extensions(VALUE self)
|
||||
|
||||
GetX509(self, x509);
|
||||
count = X509_get_ext_count(x509);
|
||||
if (count < 0) {
|
||||
return rb_ary_new();
|
||||
}
|
||||
ary = rb_ary_new2(count);
|
||||
ary = rb_ary_new_capa(count);
|
||||
for (i=0; i<count; i++) {
|
||||
ext = X509_get_ext(x509, i); /* NO DUP - don't free! */
|
||||
rb_ary_push(ary, ossl_x509ext_new(ext));
|
||||
|
@ -449,11 +449,7 @@ ossl_x509crl_get_extensions(VALUE self)
|
||||
|
||||
GetX509CRL(self, crl);
|
||||
count = X509_CRL_get_ext_count(crl);
|
||||
if (count < 0) {
|
||||
OSSL_Debug("count < 0???");
|
||||
return rb_ary_new();
|
||||
}
|
||||
ary = rb_ary_new2(count);
|
||||
ary = rb_ary_new_capa(count);
|
||||
for (i=0; i<count; i++) {
|
||||
ext = X509_CRL_get_ext(crl, i); /* NO DUP - don't free! */
|
||||
rb_ary_push(ary, ossl_x509ext_new(ext));
|
||||
|
@ -194,11 +194,7 @@ ossl_x509revoked_get_extensions(VALUE self)
|
||||
|
||||
GetX509Rev(self, rev);
|
||||
count = X509_REVOKED_get_ext_count(rev);
|
||||
if (count < 0) {
|
||||
OSSL_Debug("count < 0???");
|
||||
return rb_ary_new();
|
||||
}
|
||||
ary = rb_ary_new2(count);
|
||||
ary = rb_ary_new_capa(count);
|
||||
for (i=0; i<count; i++) {
|
||||
ext = X509_REVOKED_get_ext(rev, i);
|
||||
rb_ary_push(ary, ossl_x509ext_new(ext));
|
||||
|
Loading…
x
Reference in New Issue
Block a user