summaryrefslogtreecommitdiff
path: root/ext/standard/html.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-01-02 19:49:30 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-01-02 19:49:30 +0000
commit0ff59a1353fcf232a73c8946746fa7d93e5e1096 (patch)
tree9b3b7d34f162fb86ca1889c1e4cc0a3a847a0729 /ext/standard/html.c
parentb46352043c69880e97d3487458a63467e355cc3a (diff)
downloadphp-git-0ff59a1353fcf232a73c8946746fa7d93e5e1096.tar.gz
Fixed bug #21338 (crash inside html_entity_decode() when "" is passed).
Added test case for the bug.
Diffstat (limited to 'ext/standard/html.c')
-rw-r--r--ext/standard/html.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 5385d5609c..4e7d51be59 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -674,6 +674,9 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
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 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
efree(ret);
ret = replaced;
}
-
+empty_source:
*newlen = retlen;
return ret;
}