From 08b81a1321e385c65fe28d1b9092d7051d44cc69 Mon Sep 17 00:00:00 2001 From: ndossche Date: Tue, 27 Jan 2026 12:03:51 +0100 Subject: [PATCH] Fix error check on X509V3_EXT_print() The docs I found of this function appear to be wrong, as it can also return -1 on failure. See also https://github.com/openssl/openssl/pull/29793 --- ext/openssl/openssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 12383ac8c2c8..62b0962f41fb 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2256,7 +2256,7 @@ PHP_FUNCTION(openssl_x509_parse) goto err_subitem; } } - else if (X509V3_EXT_print(bio_out, extension, 0, 0)) { + else if (X509V3_EXT_print(bio_out, extension, 0, 0) > 0) { BIO_get_mem_ptr(bio_out, &bio_buf); add_assoc_stringl(&subitem, extname, bio_buf->data, bio_buf->length); } else {