From: Rasmus Lerdorf Date: Wed, 31 Mar 2010 23:56:30 +0000 (+0000) Subject: Fix FILTER_VALIDATE_URL - Host names can't start with '.' or '-' X-Git-Tag: php-5.3.3RC1~356 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b529350d4a90aa326daaef5c51de49d35d92992f;p=php Fix FILTER_VALIDATE_URL - Host names can't start with '.' or '-' --- diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c index 28fae50226..008b0780c0 100644 --- a/ext/filter/logical_filters.c +++ b/ext/filter/logical_filters.c @@ -465,6 +465,11 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */ e = url->host + strlen(url->host); s = url->host; + /* First char of hostname must be alphanumeric */ + if(!isalnum((int)*(unsigned char *)s)) { + goto bad_url; + } + while (s < e) { if (!isalnum((int)*(unsigned char *)s) && *s != '-' && *s != '.') { goto bad_url;