Skip to content

Commit 369b7b2

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 fb80f35 commit 369b7b2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ext/openssl/openssl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3378,7 +3378,11 @@ PHP_FUNCTION(openssl_csr_sign)
33783378
goto cleanup;
33793379
}
33803380
} else {
3381-
PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial);
3381+
if (!PHP_OPENSSL_ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial)) {
3382+
php_openssl_store_errors();
3383+
php_error_docref(NULL, E_WARNING, "Error setting serial number");
3384+
goto cleanup;
3385+
}
33823386
}
33833387

33843388
X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr));

0 commit comments

Comments
 (0)