scottmac Sun Mar 29 23:32:17 2009 UTC
Modified files:
/php-src/ext/openssl openssl.c
Log:
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.179&r2=1.180&diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.179 php-src/ext/openssl/openssl.c:1.180
--- php-src/ext/openssl/openssl.c:1.179 Tue Mar 10 23:39:27 2009
+++ php-src/ext/openssl/openssl.c Sun Mar 29 23:32:17 2009
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: openssl.c,v 1.179 2009/03/10 23:39:27 helly Exp $ */
+/* $Id: openssl.c,v 1.180 2009/03/29 23:32:17 scottmac Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -557,10 +557,12 @@
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_utf8_stringl(subentries,
(char *)to_add, to_add_len, 1);
} else {
to_add = ASN1_STRING_data(str);
to_add_len = ASN1_STRING_length(str);
+ }
+
+ if (to_add_len != -1) {
add_next_index_utf8_stringl(subentries,
(char *)to_add, to_add_len, 1);
}
}
@@ -573,7 +575,7 @@
} else {
zval_dtor(subentries);
FREE_ZVAL(subentries);
- if (obj_cnt && str) {
+ if (obj_cnt && str && to_add_len != -1) {
add_ascii_assoc_utf8_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