Skip to content

Commit 861fa60

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #78814: strip_tags allows / in tag name => whitelist bypass
2 parents bb735c9 + 600f1f8 commit 861fa60

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
@@ -29,6 +29,8 @@ PHP NEWS
2929
. Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
3030
. Fixed bug #78833 (Integer overflow in pack causes out-of-bound access).
3131
(cmb)
32+
. Fixed bug #78814 (strip_tags allows / in tag name => whitelist bypass).
33+
(cmb)
3234

3335
21 Nov 2019, PHP 7.3.12
3436

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5003,7 +5003,7 @@ int php_tag_find(char *tag, size_t len, const char *set) {
50035003
if (state == 0) {
50045004
state=1;
50055005
}
5006-
if (c != '/') {
5006+
if (c != '/' || (*(t-1) != '<' && *(t+1) != '>')) {
50075007
*(n++) = c;
50085008
}
50095009
} 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)