Skip to content

Commit 22c9e7e

Browse files
committed
Add missing error check on PEM_write_bio_PKCS7()
Closes GH-10752.
1 parent 51ea4a6 commit 22c9e7e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
- Opcache:
1313
. Fixed build for macOS to cater with pkg-config settings. (David Carlier)
1414

15+
- OpenSSL:
16+
. Add missing error checks on file writing functions. (nielsdos)
17+
1518
- Phar:
1619
. Fixed bug GH-10766 (PharData archive created with Phar::Zip format does
1720
not keep files metadata (datetime)). (nielsdos)

ext/openssl/openssl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5406,7 +5406,11 @@ PHP_FUNCTION(openssl_pkcs7_verify)
54065406
}
54075407

54085408
if (p7bout) {
5409-
PEM_write_bio_PKCS7(p7bout, p7);
5409+
if (PEM_write_bio_PKCS7(p7bout, p7) == 0) {
5410+
php_error_docref(NULL, E_WARNING, "Failed to write PKCS7 to file");
5411+
php_openssl_store_errors();
5412+
RETVAL_FALSE;
5413+
}
54105414
}
54115415
}
54125416
} else {

0 commit comments

Comments
 (0)