Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Net-IPv4Addr CPAN distribution.

Report information
The Basics
Id: 1525
Status: new
Priority: 0/
Queue: Net-IPv4Addr

People
Owner: Nobody in particular
Requestors: dmitri [...] netilla.com
Cc:
AdminCc:

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



Subject: Wrong regular expression to match IP addresses.
Download (untitled) / with headers
text/plain 425b
The following is my setup: -------------------------- Net::IPv4Addr v0.10 Linux 2.4.16 Perl 5.6.1 The bug description: -------------------- Module Net::IPv4Addr has the following regular expression for matching valid IPv4 addresses: my $ip_rgx = "\\d+\\.\\d+\\.\\d+\\.\\d+"; The problem is that this expression allows for strings like "12.13.14.15.16". My proposed solution is my $ip_rgx = qr/^\d+\.\d+\.\d+\.\d+$/;
Download (untitled) / with headers
text/plain 855b
[guest - Tue Sep 17 14:20:03 2002]: Show quoted text
> The following is my setup: > -------------------------- > > Net::IPv4Addr v0.10 > Linux 2.4.16 > Perl 5.6.1 > > > The bug description: > -------------------- > > Module Net::IPv4Addr has the following regular expression > for matching valid IPv4 addresses: > > my $ip_rgx = "\\d+\\.\\d+\\.\\d+\\.\\d+"; > > The problem is that this expression allows for strings like > "12.13.14.15.16". My proposed solution is > > my $ip_rgx = qr/^\d+\.\d+\.\d+\.\d+$/; >
Proposed patch: --- IPv4Addr.pm-ORIG Tue Sep 17 14:43:33 2002 +++ IPv4Addr.pm Tue Sep 17 14:43:59 2002 @@ -40,7 +40,7 @@ use Carp; # Functions to manipulate IPV4 address -my $ip_rgx = "\\d+\\.\\d+\\.\\d+\\.\\d+"; +my $ip_rgx = qr/^\d+\.\d+\.\d+\.\d+$/; # Given an IPv4 address in host, ip/netmask or cidr format # returns a ip / cidr pair.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.