This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug libc/515] gethostbyname_r() returns incorrect error for certain sizes (or alignment)
- From: "guillaume at morinfr dot org" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 9 Nov 2004 02:41:13 -0000
- Subject: [Bug libc/515] gethostbyname_r() returns incorrect error for certain sizes (or alignment)
- References: <20041104163517.515.gmorin1@bloomberg.net>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From guillaume at morinfr dot org 2004-11-09 02:41 -------
Goto,
I setup a good way to reproduce it on a Debian sid. I got exactly the same
results on a PPC box running 2.6.9 and a x86 one running 2.4.27:
guillaum@siri:~$ tail -1 /etc/hosts
127.0.0.8 foo 0 01 012 0123 01234 012345 0123456 01234567 012345678 0123456789
01234567890 012345678901 012345678901 0123456789012 01234567890123
012345678901234 0123456789012345 01234567890123456 012345678901234567
guillaum@siri:~$ gcc -o foo foo.c -Wall -DBUFFER_SIZE=128 && ./foo
ret is 34, result is (nil), err is -1
error: Numerical result out of range.
guillaum@siri:~$ gcc -o foo foo.c -Wall -DBUFFER_SIZE=256 && ./foo
ret is 22, result is (nil), err is 1
error: Invalid argument.
guillaum@siri:~$ gcc -o foo foo.c -Wall -DBUFFER_SIZE=512 && ./foo
ret is 0, result is 0x7ffff860, err is 1
Success resolving foo. Found aliases: 0 01 012 0123 01234 012345 0123456
01234567 012345678 0123456789 01234567890 012345678901 012345678901
0123456789012 01234567890123 012345678901234 0123456789012345 01234567890123456
012345678901234567
guillaum@siri:~$
This time we get EINVAL for a 256-byte buffer. Afaict this is bogus. The result
is not that different anyway since we're getting err == 1 which is HOST_NOT_FOUND.
HTH.
Guillaume.
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=515
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.