Skip to content

Commit 7831244

Browse files
authored
openssl: Fix missing error propagation in openssl_x509_export() (#21375)
The file writes can have failed, but this error isn't visible for the application, fix it by propagating the error properly.
1 parent 1c94632 commit 7831244

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ext/openssl/openssl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,8 +1869,7 @@ PHP_FUNCTION(openssl_x509_export)
18691869
}
18701870
if (!notext && !X509_print(bio_out, cert)) {
18711871
php_openssl_store_errors();
1872-
}
1873-
if (PEM_write_bio_X509(bio_out, cert)) {
1872+
} else if (PEM_write_bio_X509(bio_out, cert)) {
18741873
BUF_MEM *bio_buf;
18751874

18761875
BIO_get_mem_ptr(bio_out, &bio_buf);

0 commit comments

Comments
 (0)