scottmac                Sun Mar 29 23:32:34 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /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.41.2.27&r2=1.98.2.5.2.41.2.28&diff_format=u
Index: php-src/ext/openssl/openssl.c
diff -u php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.27 
php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.28
--- php-src/ext/openssl/openssl.c:1.98.2.5.2.41.2.27    Wed Dec 31 11:15:40 2008
+++ php-src/ext/openssl/openssl.c       Sun Mar 29 23:32:34 2009
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: openssl.c,v 1.98.2.5.2.41.2.27 2008/12/31 11:15:40 sebastian Exp $ */
+/* $Id: openssl.c,v 1.98.2.5.2.41.2.28 2009/03/29 23:32:34 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -575,7 +575,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);
@@ -591,7 +593,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

Reply via email to