rasmus Wed, 31 Mar 2010 23:56:30 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=297250
Log:
Fix FILTER_VALIDATE_URL - Host names can't start with '.' or '-'
Changed paths:
U php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
U php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c
U php/php-src/trunk/ext/filter/logical_filters.c
Modified: php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c 2010-03-31
23:11:35 UTC (rev 297249)
+++ php/php-src/branches/PHP_5_2/ext/filter/logical_filters.c 2010-03-31
23:56:30 UTC (rev 297250)
@@ -465,6 +465,11 @@
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;
Modified: php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c 2010-03-31
23:11:35 UTC (rev 297249)
+++ php/php-src/branches/PHP_5_3/ext/filter/logical_filters.c 2010-03-31
23:56:30 UTC (rev 297250)
@@ -465,6 +465,11 @@
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;
Modified: php/php-src/trunk/ext/filter/logical_filters.c
===================================================================
--- php/php-src/trunk/ext/filter/logical_filters.c 2010-03-31 23:11:35 UTC
(rev 297249)
+++ php/php-src/trunk/ext/filter/logical_filters.c 2010-03-31 23:56:30 UTC
(rev 297250)
@@ -465,6 +465,11 @@
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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php