1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix potential NULL pointer dereference before calling EVP_SignInit

Closes GH-13870.
This commit is contained in:
icy17
2024-04-08 14:49:17 +08:00
committed by Niels Dossche
parent af098acd6e
commit 6f8bda0582
2 changed files with 8 additions and 0 deletions

1
NEWS
View File

@@ -22,6 +22,7 @@ PHP NEWS
filename causes a NULL pointer dereference). (nielsdos)
. Fixed bug GH-13833 (Applying zero offset to null pointer in zend_hash.c).
(nielsdos)
. Fix potential NULL pointer dereference before calling EVP_SignInit. (icy17)
- PHPDBG:
. Fixed bug GH-13827 (Null pointer access of type 'zval' in phpdbg_frame).

View File

@@ -1884,6 +1884,13 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
}
md_ctx = EVP_MD_CTX_create();
if (md_ctx == NULL) {
EVP_PKEY_free(key);
if (error) {
spprintf(error, 0, "unable to initialize openssl signature for phar \"%s\"", phar->fname);
}
return FAILURE;
}
siglen = EVP_PKEY_size(key);
sigbuf = emalloc(siglen + 1);