Skip to content

Commit e5cec86

Browse files
committed
Fix potential NULL pointer dereference before calling EVP_SignInit
1 parent dad2d56 commit e5cec86

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ext/phar/util.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,10 +1890,15 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
18901890
}
18911891

18921892
md_ctx = EVP_MD_CTX_create();
1893-
1893+
if (md_ctx == NULL){
1894+
if (error) {
1895+
spprintf(error, 0, "openssl signature could not be verified");
1896+
}
1897+
return FAILURE;
1898+
}
18941899
siglen = EVP_PKEY_size(key);
18951900
sigbuf = emalloc(siglen + 1);
1896-
1901+
18971902
if (!EVP_SignInit(md_ctx, mdtype)) {
18981903
EVP_PKEY_free(key);
18991904
efree(sigbuf);

0 commit comments

Comments
 (0)