diff options
author | Renato Botelho <garga@FreeBSD.org> | 2016-09-01 10:31:05 +0000 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2016-09-01 10:31:05 +0000 |
commit | 354a1651d7914f29dcfab9672db02fcdad498a06 (patch) | |
tree | 2d21cc9d8f58d6bf3868a46430180a54489a0199 | |
parent | 966c8f8c2d914b33bf8f98425861f2849127fdec (diff) | |
download | ports-354a1651d7914f29dcfab9672db02fcdad498a06.tar.gz ports-354a1651d7914f29dcfab9672db02fcdad498a06.zip |
MFH: r421168
Fix some bad IPv6 validation issues
Following bad addresses are being validated as good by checkIPv6()
1:2:3:4:5:6:7:8:1.2.3.4
::1:2:3:4:5:6:7:8
1:2:3:4:5:6:7:8::
1:2:3:4:5:6:::8
::::a
::::
1::2::3
Obtained from: pfSense
Sponsored by: Rubicon Communications (Netgate)
Approved by: ports-secteam (feld)
Notes
Notes:
svn path=/branches/2016Q3/; revision=421202
-rw-r--r-- | net/pear-Net_IPv6/Makefile | 1 | ||||
-rw-r--r-- | net/pear-Net_IPv6/files/patch-Net_IPv6.php | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/net/pear-Net_IPv6/Makefile b/net/pear-Net_IPv6/Makefile index 93cdee0d9e83..9583b4a89536 100644 --- a/net/pear-Net_IPv6/Makefile +++ b/net/pear-Net_IPv6/Makefile @@ -3,6 +3,7 @@ PORTNAME= Net_IPv6 DISTVERSION= 1.2.1 +PORTREVISION= 1 CATEGORIES= net pear MAINTAINER= miwi@FreeBSD.org diff --git a/net/pear-Net_IPv6/files/patch-Net_IPv6.php b/net/pear-Net_IPv6/files/patch-Net_IPv6.php new file mode 100644 index 000000000000..a49822e6149f --- /dev/null +++ b/net/pear-Net_IPv6/files/patch-Net_IPv6.php @@ -0,0 +1,35 @@ +--- Net/IPv6.php.orig 2016-08-31 14:11:53 UTC ++++ Net/IPv6.php +@@ -550,7 +550,7 @@ class Net_IPv6 + + if (false !== strpos($uip, '::') ) { + +- list($ip1, $ip2) = explode('::', $uip); ++ list($ip1, $ip2) = explode('::', $uip, 2); + + if ("" == $ip1) { + +@@ -601,12 +601,12 @@ class Net_IPv6 + + } else if (-1 == $c1) { // ::xxx + +- $fill = str_repeat('0:', 7-$c2); ++ $fill = str_repeat('0:', max(1, 7-$c2)); + $uip = str_replace('::', $fill, $uip); + + } else if (-1 == $c2) { // xxx:: + +- $fill = str_repeat(':0', 7-$c1); ++ $fill = str_repeat(':0', max(1, 7-$c1)); + $uip = str_replace('::', $fill, $uip); + + } else { // xxx::xxx +@@ -912,7 +912,7 @@ class Net_IPv6 + + } + +- if (8 == $count) { ++ if (8 == $count and empty($ipPart[1])) { + + return true; + |