This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
["Alexander V. Lukyanov" <lav@long.yar.ru>] libc/1096: gethostbyname fails to handle addresses like 10.1234
- To: libc-hacker@cygnus.com
- Subject: ["Alexander V. Lukyanov" <lav@long.yar.ru>] libc/1096: gethostbyname fails to handle addresses like 10.1234
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 25 Apr 1999 22:49:56 +0200
- Cc: "Alexander V. Lukyanov" <lav@long.yar.ru>
- Mail-Copies-To: never
I've verified the appended bug report with the current glibc 2.1
version.
The problem seems to be the usage of inet_pton in nss/digits_dots.c.
inet_pton doesn't convert 10.1234 (but inet_aton should do so).
Looking at inet_pton.c from glibc I noticed that inet_pton accepts
only dotted quad:
* inet_pton4(src, dst)
* like inet_aton() but without all the hexadecimal and shorthand.
* return:
* 1 if `src' is a valid dotted quad, else 0.
Now the questions are:
- should gethostbyname accept "10.1234" ?
- should inet_pton accept "10.1234" ?
Depending on the answer to these two question, we might have to fix
digits_dots.c or inet_pton.c.
Andreas
- To: bugs@gnu.org
- Subject: libc/1096: gethostbyname fails to handle addresses like 10.1234
- From: "Alexander V. Lukyanov" <lav@long.yar.ru>
- Date: Sun, 25 Apr 1999 23:42:33 +0400
- Xref: arthur.rhein-neckar.de mail.gnats-libc-bugs:3015
>Number: 1096
>Category: libc
>Synopsis: gethostbyname("10.1234") returns NULL
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: libc-gnats
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Sun Apr 25 15:50:01 EDT 1999
>Last-Modified:
>Originator: Alexander V. Lukyanov
>Organization:
>Release: libc-2.0.7 (also libc-2.2.1)
>Environment:
Host type: i686-pc-linux-gnu
System: Linux long.yar.ru 2.2.6 #24 Sat Apr 17 22:48:59 MSD 1999 i586 unknown
Architecture: i586
Addons: crypt linuxthreads localedata
Build CFLAGS: -O2 -m486 -fno-strength-reduce -g -DNDEBUG=1
Build CC: gcc -B$(common-objpfx)
Build shared: yes
Build profile: yes
Build omitfp: no
Stdio: libio
>Description:
solaris man page documents this about dotted addresses:
Values specified using `.' notation take one of the follow-
ing forms:
a.b.c.d
a.b.c
a.b
a
...
Numbers supplied as parts in `.' notation may be decimal,
octal, or hexadecimal, as specified in the C language. For
example, a leading 0x or 0X implies hexadecimal; otherwise,
a leading 0 implies octal; otherwise, the number is inter-
preted as decimal.
These formats are also recognized by some other systems besides solaris.
Also they are parsed correctly by inet_aton.
But gethostbyname fails to parse all forms but a.b.c.d.
>How-To-Repeat:
main()
{
printf("%p\n",gethostbyname("10.1234"));
}
>Fix:
>Audit-Trail:
>Unformatted:
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de