Add missing error check on PEM_write_bio_PKCS7()

Closes GH-10752.
This commit is contained in:
Niels Dossche 2023-03-04 20:10:10 +01:00
parent 51ea4a680d
commit 22c9e7e27e
2 changed files with 8 additions and 1 deletions

3
NEWS
View file

@ -12,6 +12,9 @@ PHP NEWS
- Opcache:
. Fixed build for macOS to cater with pkg-config settings. (David Carlier)
- OpenSSL:
. Add missing error checks on file writing functions. (nielsdos)
- Phar:
. Fixed bug GH-10766 (PharData archive created with Phar::Zip format does
not keep files metadata (datetime)). (nielsdos)

View file

@ -5406,7 +5406,11 @@ PHP_FUNCTION(openssl_pkcs7_verify)
}
if (p7bout) {
PEM_write_bio_PKCS7(p7bout, p7);
if (PEM_write_bio_PKCS7(p7bout, p7) == 0) {
php_error_docref(NULL, E_WARNING, "Failed to write PKCS7 to file");
php_openssl_store_errors();
RETVAL_FALSE;
}
}
}
} else {