iliaa           Wed Nov  1 01:56:21 2006 UTC

  Modified files:              
    /php-src/ext/standard       html.c 
  Log:
  MFB: Added missing boundary checks.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.116&r2=1.117&diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.116 php-src/ext/standard/html.c:1.117
--- php-src/ext/standard/html.c:1.116   Mon Oct  2 07:54:37 2006
+++ php-src/ext/standard/html.c Wed Nov  1 01:56:21 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: html.c,v 1.116 2006/10/02 07:54:37 bjori Exp $ */
+/* $Id: html.c,v 1.117 2006/11/01 01:56:21 iliaa Exp $ */
 
 /*
  * HTML entity resources:
@@ -1107,7 +1107,7 @@
 
                matches_map = 0;
 
-               if (len + 9 > maxlen)
+               if (len + 16 > maxlen)
                        replaced = erealloc (replaced, maxlen += 128);
 
                if (all) {
@@ -1132,9 +1132,15 @@
                        }
 
                        if (matches_map) {
+                               int l = strlen(rep);
+                               /* increase the buffer size */
+                               if (len + 2 + l >= maxlen) {
+                                       replaced = erealloc(replaced, maxlen += 
128);
+                               }
+
                                replaced[len++] = '&';
                                strcpy(replaced + len, rep);
-                               len += strlen(rep);
+                               len += l;
                                replaced[len++] = ';';
                        }
                }

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

Reply via email to