mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #21453 (improper handling of non-terminated <).
This commit is contained in:
parent
15f7c2c332
commit
97dd1e8abf
@ -3413,6 +3413,9 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
|
||||
while (i < len) {
|
||||
switch (c) {
|
||||
case '<':
|
||||
if (isspace(*(p + 1))) {
|
||||
goto reg_char;
|
||||
}
|
||||
if (state == 0) {
|
||||
lc = '<';
|
||||
state = 1;
|
||||
@ -3552,6 +3555,7 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int
|
||||
|
||||
/* fall-through */
|
||||
default:
|
||||
reg_char:
|
||||
if (state == 0) {
|
||||
*(rp++) = c;
|
||||
} else if (allow && state == 1) {
|
||||
|
18
ext/standard/tests/strings/bug21453.phpt
Normal file
18
ext/standard/tests/strings/bug21453.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #21453 (handling of non-encoded <)
|
||||
--FILE--
|
||||
<?php
|
||||
$test = "
|
||||
<table>
|
||||
<tr><td>first cell before < first cell after</td></tr>
|
||||
<tr><td>second cell before < second cell after</td></tr>
|
||||
</table>";
|
||||
|
||||
var_dump(strip_tags($test));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(80) "
|
||||
|
||||
first cell before < first cell after
|
||||
second cell before < second cell after
|
||||
"
|
Loading…
Reference in New Issue
Block a user