Skip to content

Commit cea48b4

Browse files
committed
openssl: Propagate PHP_OPENSSL_ASN1_INTEGER_set() failure
If this is not propagated, then the function will succeed even though the serial number is not set.
1 parent 1d8643d commit cea48b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/openssl/openssl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3373,7 +3373,11 @@ PHP_FUNCTION(openssl_csr_sign)
33733373
goto cleanup;
33743374
}
33753375
} else {
3376-
PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial);
3376+
if (!PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial)) {
3377+
php_openssl_store_errors();
3378+
php_error_docref(NULL, E_WARNING, "Error setting serial number");
3379+
goto cleanup;
3380+
}
33773381
}
33783382

33793383
if (!X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr))) {

0 commit comments

Comments
 (0)