scottmac Sun Mar 29 23:33:01 2009 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/openssl openssl.c
Log:
MFH Fix bug #47828 - Converting to UTF-8 can sometimes fail, check error
codes and avoid segfault.
http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/openssl.c?r1=1.98.2.5.2.51&r2=1.98.2.5.2.52&diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.51
php-src/ext/openssl/openssl.c:1.98.2.5.2.52
--- php-src/ext/openssl/openssl.c:1.98.2.5.2.51 Wed Dec 31 11:17:41 2008
+++ php-src/ext/openssl/openssl.c Sun Mar 29 23:33:01 2009
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.98.2.5.2.51 2008/12/31 11:17:41 sebastian Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.52 2009/03/29 23:33:01 scottmac Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -301,7 +301,9 @@
str = X509_NAME_ENTRY_get_data(ne);
if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING)
{
to_add_len =
ASN1_STRING_to_UTF8(&to_add, str);
- add_next_index_stringl(subentries,
(char *)to_add, to_add_len, 1);
+ if (to_add_len != -1) {
+
add_next_index_stringl(subentries, (char *)to_add, to_add_len, 1);
+ }
} else {
to_add = ASN1_STRING_data(str);
to_add_len = ASN1_STRING_length(str);
@@ -317,7 +319,7 @@
} else {
zval_dtor(subentries);
FREE_ZVAL(subentries);
- if (obj_cnt && str) {
+ if (obj_cnt && str && to_add_len > -1) {
add_assoc_stringl(subitem, sname, (char
*)to_add, to_add_len, 1);
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php