From: Rasmus Lerdorf Date: Tue, 31 Dec 2002 15:18:52 +0000 (+0000) Subject: Fix for bug #21311 X-Git-Tag: PHP_5_0_dev_before_13561_fix~549 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f88e29bc0d1369de0b0a18c73ff39cc7d3a5bf87;p=php Fix for bug #21311 --- diff --git a/ext/standard/string.c b/ext/standard/string.c index d5defdc253..3626034cfd 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3509,11 +3509,12 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int /* JavaScript & Other HTML scripting languages */ if (state == 1 && *(p-1) == '<') { state = 3; + lc = c; } else { *(rp++) = c; } break; - + case '?': if (state == 1 && *(p-1)=='<') { @@ -3522,13 +3523,28 @@ PHPAPI void php_strip_tags(char *rbuf, int len, int *stateptr, char *allow, int break; } + case 'E': + case 'e': + /* !DOCTYPE exception */ + if (state==3 && p > buf+6 + && tolower(*(p-1)) == 'p' + && tolower(*(p-2)) == 'y' + && tolower(*(p-3)) == 't' + && tolower(*(p-4)) == 'c' + && tolower(*(p-5)) == 'o' + && tolower(*(p-6)) == 'd') { + state = 1; + break; + } + /* fall-through */ + case 'l': /* swm: If we encounter ' buf+2 && *(p-1) == 'm' && *(p-2) == 'x') { state = 1; break; }