Skip to content

Commit 2dc170e

Browse files
committed
More checks for php_strip_tags_ex
1 parent 7e2bd95 commit 2dc170e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4816,7 +4816,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
48164816
switch (state) {
48174817
case 1: /* HTML/XML */
48184818
lc = '>';
4819-
if (is_xml && *(p -1) == '-') {
4819+
if (is_xml && p >= buf + 1 && *(p-1) == '-') {
48204820
break;
48214821
}
48224822
in_q = state = is_xml = 0;
@@ -4837,7 +4837,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
48374837
break;
48384838

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

0 commit comments

Comments
 (0)