Skip to content

Commit 3356dd0

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78814: strip_tags allows / in tag name => whitelist bypass
2 parents a9e45bc + 861fa60 commit 3356dd0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ PHP NEWS
3030
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
3131
. Fixed bug #78833 (Integer overflow in pack causes out-of-bound access).
3232
(cmb)
33+
. Fixed bug #78814 (strip_tags allows / in tag name => whitelist bypass).
34+
(cmb)
3335

3436
28 Nov 2019, PHP 7.4.0
3537

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5118,7 +5118,7 @@ int php_tag_find(char *tag, size_t len, const char *set) {
51185118
if (state == 0) {
51195119
state=1;
51205120
}
5121-
if (c != '/') {
5121+
if (c != '/' || (*(t-1) != '<' && *(t+1) != '>')) {
51225122
*(n++) = c;
51235123
}
51245124
} else {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Bug #78814 (strip_tags allows / in tag name => whitelist bypass)
3+
--FILE--
4+
<?php
5+
echo strip_tags("<s/trong>b</strong>", "<strong>");
6+
?>
7+
--EXPECT--
8+
b</strong>

0 commit comments

Comments
 (0)