Amazingly, this bug still hasn't been fixed.  Or even commented upon by
the maintainer (who has anyway uploaded new upstream versions which
don't fix the bug in the meantime).

Here's a slightly ugly patch which I think is correct.  I'm using this
now.

--- CIDR.pm     2012-02-15 13:32:45.000000000 +0000
+++ /tmp/mdw/perl5/Net/CIDR.pm  2013-07-07 12:23:22.000000000 +0100
@@ -791,6 +792,7 @@
 sub _ipcmp {
     my $aa=shift;
     my $bb=shift;
+    my $mismatch = shift;
 
     my $isipv6_1;
     my $isipv6_2;
@@ -798,10 +800,10 @@
     ($isipv6_1, $aa)=_ipv6to4($aa);
     ($isipv6_2, $bb)=_ipv6to4($bb);
 
-    if ($isipv6_1 || $isipv6_2)
+    if (!$isipv6_1 != !$isipv6_2)
     {
-       croak "Invalid netblock: $aa-$bb"
-           unless $isipv6_1 && $isipv6_2;
+       return $mismatch if defined $mismatch;
+       croak "Invalid netblock: $aa-$bb";
     }
 
     my @a=split (/\./, $aa);
@@ -1177,8 +1179,8 @@
 
     for ($i=0; $i <= $#a; $i++)
     {
-       next if _ipcmp($b[$i], $lo) < 0;
-       next if _ipcmp($hi, $a[$i]) < 0;
+       next if _ipcmp($b[$i], $lo, -1) < 0;
+       next if _ipcmp($hi, $a[$i], -1) < 0;
        return 1;
     }
 

-- [mdw]


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to