Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Validate-IP CPAN distribution.

Report information
The Basics
Id: 31257
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Data-Validate-IP

People
Owner: Nobody in particular
Requestors: jabra [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: [Patch] is_ipv4 check the octet if it starts with zero followed by numbers
One thing that the subroutine is_ipv4 does is it checks to make sure the octets of the ip address are within the range of 0 - 255. However, if the octet is 019 then this will pass. Obviously, something like 019.8.9.1 is invalid. I have attached a patch to fix this issue.
Subject: validate_ipv4.patch
--- IP-orig.pm 2007-12-06 01:04:55.000000000 -0500 +++ IP.pm 2007-12-06 01:01:53.000000000 -0500 @@ -173,7 +173,7 @@ my(@octets) = $value =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; return unless (@octets == 4); foreach (@octets) { - return unless ($_ >= 0 && $_ <= 255); + return unless ($_ >= 0 && $_ <= 255 && $_ !~ /0\d{1,2}/); } return join('.', @octets);
Good catch on that Joshua - patch committed and regression tests updated