php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #71519
Patch php-bug-71519.patch revision 2016-02-04 06:01 UTC by moises dot silva at gmail dot com

Patch php-bug-71519.patch for OpenSSL related Bug #71519

Patch version 2016-02-04 06:01 UTC

Return to Bug #71519 | Download this patch
Patch Revisions:

Developer: moises.silva@gmail.com

--- php-5.6.17/ext/openssl/openssl.c	2016-01-06 10:14:47.000000000 -0500
+++ php-5.6.17-patched/ext/openssl/openssl.c	2016-02-04 00:46:30.763746683 -0500
@@ -1944,6 +1944,7 @@
 	char *extname;
 	BIO  *bio_out;
 	BUF_MEM *bio_buf;
+	char * serial;
 	char buf[256];
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|b", &zcert, &useshortnames) == FAILURE) {
@@ -1971,7 +1972,12 @@
 	add_assoc_name_entry(return_value, "issuer", 		X509_get_issuer_name(cert), useshortnames TSRMLS_CC);
 	add_assoc_long(return_value, "version", 			X509_get_version(cert));
 
-	add_assoc_string(return_value, "serialNumber", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)), 1); 
+	serial = BN_bn2hex(ASN1_INTEGER_to_BN(X509_get_serialNumber(cert), NULL));
+	if (!serial) {
+		RETURN_FALSE;
+	}
+	add_assoc_string(return_value, "serialNumber", serial, 1); 
+	OPENSSL_free(serial);
 
 	add_assoc_asn1_string(return_value, "validFrom", 	X509_get_notBefore(cert));
 	add_assoc_asn1_string(return_value, "validTo", 		X509_get_notAfter(cert));
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC