diff options
author | Jeremy Evans <[email protected]> | 2023-11-11 16:36:39 -0800 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2024-05-02 16:26:11 +0900 |
commit | 55720f372d65aaa14bf6925730f0c715f0179dc5 (patch) | |
tree | ddbaaab81fe38379444bab961773a4f7277521ad /ext/openssl/ossl_pkcs7.c | |
parent | c9aa63a9e06c21566c6fadda5945f04f341e4891 (diff) |
[ruby/openssl] pkcs7: raise PKCS7Error for PKCS7 without content in PKCS7.read_smime
[pkuzco: expanded the fix for other content types]
[ky: adjusted formatting and the exception type]
https://github.com/ruby/openssl/commit/07eceb7f63
Co-authored-by: pkuzco <[email protected]>
Co-authored-by: Kazuki Yamaguchi <[email protected]>
Diffstat (limited to 'ext/openssl/ossl_pkcs7.c')
-rw-r--r-- | ext/openssl/ossl_pkcs7.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index cde2ac04a4..aeeb4bf5f4 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -165,7 +165,11 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg) out = NULL; pkcs7 = SMIME_read_PKCS7(in, &out); BIO_free(in); - if(!pkcs7) ossl_raise(ePKCS7Error, NULL); + if (!pkcs7) + ossl_raise(ePKCS7Error, "Could not parse the PKCS7"); + if (!pkcs7->d.ptr) + ossl_raise(ePKCS7Error, "No content in PKCS7"); + data = out ? ossl_membio2str(out) : Qnil; SetPKCS7(ret, pkcs7); ossl_pkcs7_set_data(ret, data); |