From 47cdf98fa43a481991c229532e74c44943efcf39 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Tue, 7 Jan 2025 02:14:50 +0900 Subject: [PATCH] [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 --- ext/openssl/ossl_x509cert.c | 5 +---- ext/openssl/ossl_x509crl.c | 6 +----- ext/openssl/ossl_x509revoked.c | 6 +----- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index 0505aac2af..62f4c5c24c 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -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