From ce0e5d384d892beb80c39c47e7a91fc894e825a2 Mon Sep 17 00:00:00 2001 From: Daniel Becker Date: Sun, 8 Feb 2015 22:26:26 -0800 Subject: [PATCH] fix Net_IPv6::compress() to properly handle all-zeros address The existing implementation of Net_IPv6::compress produces an empty string when compressing the all-zeros ("::") address; fix this by checking for empty return values and replacing them with "::". --- etc/inc/IPv6.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/inc/IPv6.inc b/etc/inc/IPv6.inc index e4f86bd3f8..519cbcd09e 100644 --- a/etc/inc/IPv6.inc +++ b/etc/inc/IPv6.inc @@ -748,6 +748,12 @@ class Net_IPv6 $cip = preg_replace('/((^:)|(:$))/', '', $cip); $cip = preg_replace('/((^:)|(:$))/', '::', $cip); + if (empty($cip)) { + + $cip = "::"; + + } + if ('' != $netmask) { $cip = $cip.'/'.$netmask;