Subject: | Bug in in_network() |
Date: | Fri, 31 Aug 2012 12:18:23 +0200 |
To: | bug-Net-IPv6Addr [...] rt.cpan.org |
From: | Joacim Haggmark <joacim [...] ludd.ltu.se> |
There is a bug when using in_network() with ip-adddress that contains hex
numbers that will be more then 5 digits when converting them to decimal.
The bug is in in_network_of_size (or in new if it is supposed to support
that format).
Can be reproduced by:
#!/usr/bin/perl
use Net::IPv6Addr;
my $x = new Net::IPv6Addr("fd00::54:20c:29fe:fe14:ab4b");
$x->in_network("aa:bb:cc:dd::/64");
Patch:
*** IPv6Addr.pm.orig Wed Aug 29 17:16:31 2012
--- IPv6Addr.pm Fri Aug 31 12:11:59 2012
***************
*** 746,752 ****
$parts[$j] = 0;
}
}
! return Net::IPv6Addr->new(join(':', @parts));
}
=pod
--- 746,752 ----
$parts[$j] = 0;
}
}
! return Net::IPv6Addr->new(sprintf("%04x" x 8, @parts));
}
=pod