Skip to content

Commit f883e3a

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

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/phar/util.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,10 +1890,12 @@ 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+
return FAILURE;
1895+
}
18941896
siglen = EVP_PKEY_size(key);
18951897
sigbuf = emalloc(siglen + 1);
1896-
1898+
18971899
if (!EVP_SignInit(md_ctx, mdtype)) {
18981900
EVP_PKEY_free(key);
18991901
efree(sigbuf);

0 commit comments

Comments
 (0)