tony2001                Wed Dec 20 23:36:43 2006 UTC

  Modified files:              
    /php-src/ext/standard       string.c 
  Log:
  fix potential leak, improve length checks
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.625&r2=1.626&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.625 php-src/ext/standard/string.c:1.626
--- php-src/ext/standard/string.c:1.625 Wed Dec 20 23:30:11 2006
+++ php-src/ext/standard/string.c       Wed Dec 20 23:36:43 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.625 2006/12/20 23:30:11 tony2001 Exp $ */
+/* $Id: string.c,v 1.626 2006/12/20 23:36:43 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -6154,7 +6154,7 @@
        UChar *norm, *n;
        int state = 0, done = 0;
 
-       if (!len) {
+       if (len <= 0) {
                return 0;
        }
 
@@ -6205,7 +6205,13 @@
 int php_tag_find(char *tag, int len, char *set) {
        char c, *n, *t;
        int state=0, done=0;
-       char *norm = emalloc(len+1);
+       char *norm;
+
+       if (len <= 0) {
+               return 0;
+       }
+       
+       norm = emalloc(len+1);
 
        n = norm;
        t = tag;
@@ -6215,9 +6221,6 @@
           and turn any <a whatever...> into just <a> and any </tag>
           into <tag>
        */
-       if (!len) {
-               return 0;
-       }
        while (!done) {
                switch (c) {
                        case '<':

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

Reply via email to