aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2023-10-27 09:08:11 -0700
committerKazuki Yamaguchi <k@rhe.jp>2024-05-01 01:54:09 +0900
commit27e11f2d1dcd2fd367a2ec271a715708de22b7b9 (patch)
treeffc0161e1e3fd6e5385985491fc8738a9b393219 /ext/openssl
parent3bdde7d88dc12f8e25d42c100d4f5717b1e8853c (diff)
downloadruby-openssl-27e11f2d1dcd2fd367a2ec271a715708de22b7b9.tar.gz
pkcs7: raise ArgumentError for PKCS7 with no content in PKCS7.new
Fixes [Bug #19974] [pkuzco: expanded the fix for other content types] [ky: adjusted formatting and the exception type] Co-authored-by: pkuzco <b.naamneh@gmail.com> Co-authored-by: Kazuki Yamaguchi <k@rhe.jp>
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_pkcs7.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index dbe53476..8d28f02f 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -346,6 +346,8 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
BIO_free(in);
if (!p7)
ossl_raise(rb_eArgError, "Could not parse the PKCS7");
+ if (!p7->d.ptr)
+ ossl_raise(rb_eArgError, "No content in PKCS7");
RTYPEDDATA_DATA(self) = p7;
PKCS7_free(p7_orig);