Commit cea48b4781f for php.net
commit cea48b4781fc4d890e62a6ab7212c9e88d48ffcf
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Sat Mar 7 11:38:53 2026 +0100
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.
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 46047448822..7bd2748c0ae 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -3373,7 +3373,11 @@ PHP_FUNCTION(openssl_csr_sign)
goto cleanup;
}
} else {
- PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial);
+ if (!PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial)) {
+ php_openssl_store_errors();
+ php_error_docref(NULL, E_WARNING, "Error setting serial number");
+ goto cleanup;
+ }
}
if (!X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr))) {