com php-src: Store errors in openssl_x509_export: ext/openssl/openssl.c
| From: | Jakub Zelenka | Date: | Wed, 20 Jan 2016 20:31:09 +0000 |
| Subject: | com php-src: Store errors in openssl_x509_export: ext/openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92463@lists.php.net to get a copy of this message | ||
Commit: 555126e90b4965c4958cfdf2e3c28531e295a6b2
Author: Jakub Zelenka <bukka@php.net> Wed, 20 Jan 2016 20:31:09 +0000
Parents: 63f8ef6ee154c3910b92cc4bb6d4c5a0132c7d62
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=555126e90b4965c4958cfdf2e3c28531e295a6b2
Log:
Store errors in openssl_x509_export
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 0513a90..ebd22e8 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1890,8 +1890,12 @@ PHP_FUNCTION(openssl_x509_export)
}
bio_out = BIO_new(BIO_s_mem());
- if (!notext) {
- X509_print(bio_out, cert);
+ if (!bio_out) {
+ php_openssl_store_errors();
+ goto cleanup;
+ }
+ if (!notext && !X509_print(bio_out, cert)) {
+ php_openssl_store_errors();
}
if (PEM_write_bio_X509(bio_out, cert)) {
BUF_MEM *bio_buf;
@@ -1901,12 +1905,16 @@ PHP_FUNCTION(openssl_x509_export)
ZVAL_STRINGL(zout, bio_buf->data, bio_buf->length);
RETVAL_TRUE;
+ } else {
+ php_openssl_store_errors();
}
- if (certresource == NULL && cert) {
+ BIO_free(bio_out);
+
+cleanup:
+ if (certresource == NULL && cert != NULL) {
X509_free(cert);
}
- BIO_free(bio_out);
}
/* }}} */