#50830 [NEW]: FILTER_VALIDATE_IP incorrectly validates a compressed IPv4-mapped IPv6 address
| From: | mikerushton at hotmail dot co dot uk | Date: | Sun, 24 Jan 2010 15:45:29 +0000 |
| Subject: | #50830 [NEW]: FILTER_VALIDATE_IP incorrectly validates a compressed IPv4-mapped IPv6 address | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146897@lists.php.net to get a copy of this message | ||
From: mikerushton at hotmail dot co dot uk
Operating system: Windows Vista
PHP version: 5.3.1
PHP Bug Type: Filter related
Bug description: FILTER_VALIDATE_IP incorrectly validates a compressed IPv4-mapped IPv6 address
Description:
------------
FILTER_VALIDATE_IP validates the incorrect 0:::255.255.255.255 and does
not validate the correct 0::255.255.255.255
According to RFC 5321, the correct syntax is:
[IPv6-hex *3(":" IPv6-hex)] "::" [IPv6-hex *3(":" IPv6-hex)
":"] IPv4-
address-literal
This does not allow for three consecutive colons.
Reproduce code:
---------------
// First
filter_var('FFFF:::255.255.255.255', FILTER_VALIDATE_IP);
// Second
filter_var('FFFF::255.255.255.255', FILTER_VALIDATE_IP);
Expected result:
----------------
// First
bool(false)
// Second
string(21) 'FFFF::255.255.255.255'
Actual result:
--------------
// First
string(22) 'FFFF:::255.255.255.255'
// Second
bool(false)
--
Edit bug report at http://bugs.php.net/?id=50830&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50830&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50830&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50830&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50830&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50830&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50830&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50830&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50830&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50830&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50830&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50830&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50830&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50830&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50830&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50830&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50830&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50830&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50830&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50830&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50830&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50830&r=mysqlcfg