com php-src: Revert "Fixed bug #72165 Null pointer dereference - openssl_csr_new": ext/openssl/openssl.c ext/opens sl/tests/bug72165.phpt
| From: | Anatol Belski | Date: | Fri, 06 May 2016 07:19:04 +0000 |
| Subject: | com php-src: Revert "Fixed bug #72165 Null pointer dereference - openssl_csr_new": ext/openssl/openssl.c ext/opens sl/tests/bug72165.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92041@lists.php.net to get a copy of this message | ||
Commit: dd5479ea4c0f6b3dcb57af2b877e6b4bb2a0b319
Author: Anatol Belski <ab@php.net> Fri, 6 May 2016 09:19:04 +0200
Parents: 7277c85765d1053c8cd1d1093902df541b3d101a
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dd5479ea4c0f6b3dcb57af2b877e6b4bb2a0b319
Log:
Revert "Fixed bug #72165 Null pointer dereference - openssl_csr_new"
This reverts commit 7277c85765d1053c8cd1d1093902df541b3d101a.
Bugs:
https://bugs.php.net/72165
Changed paths:
M ext/openssl/openssl.c
D ext/openssl/tests/bug72165.phpt
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 44b3fa4..4a096f7 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -2764,18 +2764,12 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ *
csr, z
}
}
if (attribs) {
- zend_long numindex;
- ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(attribs), numindex, strindex, item) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(attribs), strindex, item) {
int nid;
convert_to_string_ex(item);
- if (NULL == strindex) {
- char tmp[ZEND_LTOA_BUF_LEN];
- ZEND_LTOA(numindex, tmp, ZEND_LTOA_BUF_LEN);
- nid = OBJ_txt2nid(tmp);
- } else {
- nid = OBJ_txt2nid(ZSTR_VAL(strindex));
- }
+
+ nid = OBJ_txt2nid(ZSTR_VAL(strindex));
if (nid != NID_undef) {
if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8, (unsigned char*)Z_STRVAL_P(item),
-1, -1, 0)) {
php_error_docref(NULL, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)",
nid, Z_STRVAL_P(item));
diff --git a/ext/openssl/tests/bug72165.phpt b/ext/openssl/tests/bug72165.phpt
deleted file mode 100644
index c7e0d1a..0000000
--- a/ext/openssl/tests/bug72165.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #72165 Null pointer dereference - openssl_csr_new
---SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
---FILE--
-<?php
-$var0 = array(0 => "hello", 1 => "world");
-$var2 = openssl_csr_new(array(0),$var0,null,array(0));
-?>
-==DONE==
---EXPECTF--
-Warning: openssl_csr_new(): dn: is not a recognized name in %sbug72165.php on line %d
-
-Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error
queue and value of string_mask OpenSSL option if illegal characters are reported) in %sbug72165.php
on line %d
-==DONE==