summaryrefslogtreecommitdiff
path: root/ext/standard/url.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-05-26 03:56:21 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-05-26 03:56:21 +0000
commitfddaa54410f7cbc4a3241f5a58efc2111596a662 (patch)
treea52a926db394dc92dcc274851eb2c11c596d2ba0 /ext/standard/url.c
parentff525e55df015c24631e4bc74df435e6f582fe76 (diff)
downloadphp-git-fddaa54410f7cbc4a3241f5a58efc2111596a662.tar.gz
Added scheme validation for parse_url().
Diffstat (limited to 'ext/standard/url.c')
-rw-r--r--ext/standard/url.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c
index 63c5f60dd5..4d07d249bb 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -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));