]> granicus.if.org Git - php/commitdiff
Add RFC 6598 IPs to reserved addresses
authorSebastian Nohn <sebastian@nohn.net>
Sun, 15 Sep 2013 17:18:20 +0000 (19:18 +0200)
committerDavid Soria Parra <dsp@php.net>
Tue, 17 Sep 2013 07:52:53 +0000 (09:52 +0200)
(cherry picked from commit b3f5b822e9f83d99d7cb5eed36ba8d307d1408ee)

ext/filter/logical_filters.c
ext/filter/tests/018.phpt

index c8f94a772cb50bb984081ba7ca2f3d63d47f3e60..71c5aba1e932336d1e2b9dd3390a2145d90b46ce 100644 (file)
@@ -714,6 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
                        if (flags & FILTER_FLAG_NO_RES_RANGE) {
                                if (
                                        (ip[0] == 0) ||
+                                       (ip[0] == 100 && (ip[1] == 0 || ip[1] <= 127)) ||
                                        (ip[0] == 128 && ip[1] == 0) ||
                                        (ip[0] == 191 && ip[1] == 255) ||
                                        (ip[0] == 169 && ip[1] == 254) ||
index af52b2e60d67e9bdca799fdff2704203d47c1ca9..9c73fc3cfc4e61a40914d825b8788246480561dc 100644 (file)
@@ -15,6 +15,8 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
 var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
 var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
 var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
+var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
 var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
 var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
 var_dump(filter_var("255.255.255.255", FILTER_VALIDATE_IP));
@@ -40,6 +42,8 @@ bool(false)
 string(12) "192.0.34.166"
 bool(false)
 string(9) "192.0.0.1"
+bool(false)
+bool(false)
 string(12) "192.0.34.166"
 bool(false)
 string(15) "255.255.255.255"