1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00

MFH: Added scheme validation for parse_url().

This commit is contained in:
Ilia Alshanetsky
2005-05-26 03:56:34 +00:00
parent 00448a5211
commit 5a27a76b1b

View File

@@ -104,6 +104,19 @@ PHPAPI php_url *php_url_parse_ex(char const *str, int length)
/* parse scheme */
if ((e = memchr(s, ':', length)) && (e - s)) {
/* validate scheme */
p = s;
while (p < e) {
if (!isalnum(*p)) {
if (e + 1 < ue) {
goto parse_port;
} else {
goto just_path;
}
}
p++;
}
if (*(e + 1) == '\0') { /* only scheme is available */
ret->scheme = estrndup(s, (e - s));
php_replace_controlchars_ex(ret->scheme, (e - s));