public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/295] New: inet_pton4() should disallow leading zeros (ambiguity with legacy octal)
@ 2004-08-01 21:47 a dot guru at sympatico dot ca
  2004-08-01 21:50 ` [Bug libc/295] " a dot guru at sympatico dot ca
  2004-08-05 22:22 ` jakub at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: a dot guru at sympatico dot ca @ 2004-08-01 21:47 UTC (permalink / raw)
  To: glibc-bugs

This is for [glibc-2.3.3-200407231111],
file resolv/inet_pton.c,
function inet_pton4().

This is _not_ the usual complaint regarding the behavior of
inet_pton(AF_INET, foo, bar) vs inet_addr(foo).

The string "010.000.000.035" will be interpreted as the
IPv4 address 8.0.0.29 by inet_addr() and as the IPv4
address 10.0.0.35 by inet_pton().  This is bad.  If
inet_pton() doesn't want an input_format/interpretation
pair accepted by inet_addr(), it should just reject that
input_format with an error like it does for hexadecimal for
instance.

Unfortunately, the Internet RFCs are not strict on the
subject.  It can be argued that returning an error does
not contradict the RFCs, however, but rather follows
their spirit.

RFC 2373 "IP Version 6 Addressing Architecture" states in
"APPENDIX B: ABNF Description of Text Representations" that

      IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT

and RFC 3493 "Basic Socket Interface Extensions for IPv6"
states in "6.3 Address Conversion Functions" that

   If the af argument of inet_pton() is AF_INET, the src string shall be
   in the standard IPv4 dotted-decimal form:

      ddd.ddd.ddd.ddd

   where "ddd" is a one to three digit decimal number between 0 and 255.
   The inet_pton() function does not accept other formats (such as the
   octal numbers, hexadecimal numbers, and fewer than four numbers that
   inet_addr() accepts).

A proposed patch follows.  I wrote it and I am putting it in the public
domain.

-- 
           Summary: inet_pton4() should disallow leading zeros (ambiguity
                    with legacy octal)
           Product: glibc
           Version: 2.3.3
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: a dot guru at sympatico dot ca
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: n/a
  GCC host triplet: n/a
GCC target triplet: n/a


http://sources.redhat.com/bugzilla/show_bug.cgi?id=295

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/295] inet_pton4() should disallow leading zeros (ambiguity with legacy octal)
  2004-08-01 21:47 [Bug libc/295] New: inet_pton4() should disallow leading zeros (ambiguity with legacy octal) a dot guru at sympatico dot ca
@ 2004-08-01 21:50 ` a dot guru at sympatico dot ca
  2004-08-05 22:22 ` jakub at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: a dot guru at sympatico dot ca @ 2004-08-01 21:50 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From a dot guru at sympatico dot ca  2004-08-01 21:50 -------
Created an attachment (id=148)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=148&action=view)
patch to disallow octal notation in inet_pton4()


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=295

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/295] inet_pton4() should disallow leading zeros (ambiguity with legacy octal)
  2004-08-01 21:47 [Bug libc/295] New: inet_pton4() should disallow leading zeros (ambiguity with legacy octal) a dot guru at sympatico dot ca
  2004-08-01 21:50 ` [Bug libc/295] " a dot guru at sympatico dot ca
@ 2004-08-05 22:22 ` jakub at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at redhat dot com @ 2004-08-05 22:22 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2004-08-05 22:22 -------
A slightly different patch has been checked in.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sources.redhat.com/bugzilla/show_bug.cgi?id=295

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-05 22:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-01 21:47 [Bug libc/295] New: inet_pton4() should disallow leading zeros (ambiguity with legacy octal) a dot guru at sympatico dot ca
2004-08-01 21:50 ` [Bug libc/295] " a dot guru at sympatico dot ca
2004-08-05 22:22 ` jakub at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).