Skip Menu |

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

Report information
The Basics
Id: 40293
Status: resolved
Priority: 0/
Queue: NetAddr-IP

People
Owner: Nobody in particular
Requestors: smurf [...] smurf.noris.de
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 4.012
Fixed in: (no value)



Subject: Major IPv4 address parsing bug
DB<1> use NetAddr::IP::Lite DB<2> $x=NetAddr::IP::Lite->new("10.022.3.4") <== "22" DB<3> p $x 10.18.3.4/32 <== "18" ?!?!? DB<4> $x=NetAddr::IP::Lite->new("10.099.3.4") DB<5> p $x [ nothing ] Umm, needless to say, this is *very* broken. IP addresses are not octal numbers. Please fix ASAP. Thanks.
Subject: Re: [rt.cpan.org #40293] Major IPv4 address parsing bug
Date: Thu, 23 Oct 2008 15:17:34 -0700 (PDT)
To: "http://smurfix.livejournal.com/ via RT" <bug-NetAddr-IP [...] rt.cpan.org>
From: Michael Robinton <michael [...] insulin-pumpers.org>
On Thu, 23 Oct 2008, http://smurfix.livejournal.com/ via RT wrote: Show quoted text
> Thu Oct 23 04:15:50 2008: Request 40293 was acted upon. > Transaction: Ticket created by http://smurfix.livejournal.com/ > Queue: NetAddr-IP > Subject: Major IPv4 address parsing bug > Broken in: 4.012 > Severity: Critical > Owner: Nobody > Requestors: smurf@smurf.noris.de > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=40293 > > > > DB<1> use NetAddr::IP::Lite > > DB<2> $x=NetAddr::IP::Lite->new("10.022.3.4") <== "22"
read the docs for how inet_aton works. If you preceed the number by a 0, it is assumed to be octal. NetAddr::IP works exactly the same way. Best regards, Michael Show quoted text
> > DB<3> p $x > 10.18.3.4/32 <== "18" ?!?!? > DB<4> $x=NetAddr::IP::Lite->new("10.099.3.4") > > DB<5> p $x > [ nothing ] > > Umm, needless to say, this is *very* broken. > IP addresses are not octal numbers. > > Please fix ASAP. Thanks. >
Subject: Re: [rt.cpan.org #40293] Major IPv4 address parsing bug
Date: Fri, 24 Oct 2008 03:09:19 +0200
To: "michael\ [...] insulin-pumpers\.org via RT" <bug-NetAddr-IP [...] rt.cpan.org>
From: Matthias Urlichs <smurf [...] smurf.noris.de>
Hi, michael@insulin-pumpers.org via RT: Show quoted text
> read the docs for how inet_aton works. If you preceed the number by a 0, > it is assumed to be octal. NetAddr::IP works exactly the same way. >
The problem is that there are a lot of cases where people are printing IP addresses with %03d.%03d.%03d.%03d format strings (I hit this problem when parsing Received: headers). The use case for octal IP addresses, on the other hand, is nonexistent. Oh well. I'll use a regexp to filter the zeroes away then. -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de v4sw7$Yhw6+8ln7ma7u7L!wl7DUi2e6t3TMWb8HAGen6g3a4s6Mr1p-3/-6 hackerkey.com - - Life's the same, except for the shoes. - The Cars
Subject: Re: [rt.cpan.org #40293] Major IPv4 address parsing bug
Date: Fri, 24 Oct 2008 13:48:05 -0700
To: bug-NetAddr-IP [...] rt.cpan.org
From: michael [...] insulin-pumpers.org
Show quoted text
> Queue: NetAddr-IP > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=40293 > > > Hi, > > michael@insulin-pumpers.org via RT:
> > read the docs for how inet_aton works. If you preceed the number by > > a 0, it is assumed to be octal. NetAddr::IP works exactly the same > > way. > >
> The problem is that there are a lot of cases where people are printing > IP addresses with %03d.%03d.%03d.%03d format strings (I hit this > problem when parsing Received: headers). > > The use case for octal IP addresses, on the other hand, is > nonexistent. > > Oh well. I'll use a regexp to filter the zeroes away then. >
hmm.... perhaps that speaks to a need for a built in filter for these non-octal octal formated IP addresses. Look for the method $ip = new_no NetAddr::IP('octal_formated dotquad); method in the next release. Michael Show quoted text
> -- > Matthias Urlichs | {M:U} IT Design @ m-u-it.de | > smurf@smurf.noris.de Disclaimer: The quote was selected randomly. > Really. | http://smurf.noris.de > v4sw7$Yhw6+8ln7ma7u7L!wl7DUi2e6t3TMWb8HAGen6g3a4s6Mr1p-3/-6 > hackerkey.com > - - > Life's the same, except for the shoes. > - The Cars
Subject: Re: [rt.cpan.org #40293] Major IPv4 address parsing bug
Date: Sat, 25 Oct 2008 11:08:25 +0200
To: "michael\ [...] insulin-pumpers\.org via RT" <bug-NetAddr-IP [...] rt.cpan.org>
From: Matthias Urlichs <smurf [...] smurf.noris.de>
Hi, michael@insulin-pumpers.org via RT: Show quoted text
> Look for the method > > $ip = new_no NetAddr::IP('octal_formated dotquad); method in the next > release. >
Thanks, that'd work. -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de v4sw7$Yhw6+8ln7ma7u7L!wl7DUi2e6t3TMWb8HAGen6g3a4s6Mr1p-3/-6 hackerkey.com - - A friend asks only for your time, not your money.
New method new_no added in release 4.013