iliaa           Thu Jan  2 14:49:30 2003 EDT

  Added files:                 
    /php4/ext/standard/tests/strings    bug21338.phpt 

  Modified files:              
    /php4/ext/standard  html.c 
  Log:
  Fixed bug #21338 (crash inside html_entity_decode() when "" is passed).
  Added test case for the bug.
  
  
Index: php4/ext/standard/html.c
diff -u php4/ext/standard/html.c:1.68 php4/ext/standard/html.c:1.69
--- php4/ext/standard/html.c:1.68       Tue Dec 31 11:07:42 2002
+++ php4/ext/standard/html.c    Thu Jan  2 14:49:30 2003
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: html.c,v 1.68 2002/12/31 16:07:42 sebastian Exp $ */
+/* $Id: html.c,v 1.69 2003/01/02 19:49:30 iliaa Exp $ */
 
 #include "php.h"
 #if PHP_WIN32
@@ -674,6 +674,9 @@
        
        ret = estrdup(old);
        retlen = oldlen;
+       if (!retlen) {
+               goto empty_source;
+       }
        
        if (all) {
                /* look for a match in the maps for this charset */
@@ -722,7 +725,7 @@
                efree(ret);
                ret = replaced;
        }
-       
+empty_source:  
        *newlen = retlen;
        return ret;
 }

Index: php4/ext/standard/tests/strings/bug21338.phpt
+++ php4/ext/standard/tests/strings/bug21338.phpt
--TEST--
Bug #20934 (html_entity_decode() crash when "" is passed)
--FILE--
<?php
        var_dump(html_entity_decode(NULL));
        var_dump(html_entity_decode(""));
?>
--EXPECT--
string(0) ""
string(0) ""



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to