summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/string.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 1be460d73e..36807aa630 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -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 '<':