]> granicus.if.org Git - php/commitdiff
MFH
authorAntony Dovgal <tony2001@php.net>
Wed, 20 Dec 2006 23:36:56 +0000 (23:36 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 20 Dec 2006 23:36:56 +0000 (23:36 +0000)
ext/standard/string.c

index 1be460d73eb5ebb7530d4a9a6e847cb854dcd3d9..36807aa630353cf617c24acd2a8a2bdbe8d0fe1a 100644 (file)
@@ -4045,7 +4045,13 @@ PHP_FUNCTION(parse_str)
 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;
@@ -4055,9 +4061,6 @@ int php_tag_find(char *tag, int len, char *set) {
           and turn any <a whatever...> into just <a> and any </tag>
           into <tag>
        */
-       if (!len) {
-               return 0;
-       }
        while (!done) {
                switch (c) {
                        case '<':