Skip to content

Commit

Permalink
More checks for php_strip_tags_ex
Browse files Browse the repository at this point in the history
  • Loading branch information
smalyshev committed Jan 23, 2020
1 parent 7e2bd95 commit 2dc170e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -4816,7 +4816,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
switch (state) {
case 1: /* HTML/XML */
lc = '>';
if (is_xml && *(p -1) == '-') {
if (is_xml && p >= buf + 1 && *(p-1) == '-') {
break;
}
in_q = state = is_xml = 0;
Expand All @@ -4837,7 +4837,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
break;

case 2: /* PHP */
if (!br && lc != '\"' && *(p-1) == '?') {
if (!br && lc != '\"' && p >= buf + 1 && *(p-1) == '?') {
in_q = state = 0;
tp = tbuf;
}
Expand Down

0 comments on commit 2dc170e

Please sign in to comment.