Skip to content

Commit

Permalink
Add missing error check on PEM_write_bio_CMS()
Browse files Browse the repository at this point in the history
On failure, this function returns 0. 2 other callers of this function
already check the return value, but this one was missed.
  • Loading branch information
nielsdos committed Mar 5, 2023
1 parent d2ef156 commit 51ea4a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ext/openssl/openssl.c
Expand Up @@ -5991,7 +5991,11 @@ PHP_FUNCTION(openssl_cms_verify)
}

if (p7bout) {
PEM_write_bio_CMS(p7bout, cms);
if (PEM_write_bio_CMS(p7bout, cms) == 0) {
php_error_docref(NULL, E_WARNING, "Failed to write CMS to file");
php_openssl_store_errors();
RETVAL_FALSE;
}
}
}
} else {
Expand Down

0 comments on commit 51ea4a6

Please sign in to comment.