This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gethostbyname doesn't check invalid input


Hi

I found a weird thing about gethostbyname and getaddrinfo. When the 
argument is in the form "1.2.3.4 blablabla" (it contains a valid numeric 
ipv4 address, then space and then some garbage), it is correctly resolved 
despite the trailing garbage. If it contains a name, space and garbage, it 
is rejected ("www.gnu.org blabla" doesn't resolve).

What is even more weird - that Linux/glibc, Solaris, NetBSD and HP-UX all 
behave in the same way - they accept a space and a trailing garbage after 
numeric ipv4 address.

Is it a bug or is it correct behavior? Is it specified somewhere? Is there 
some reason for accepting a space and trailing garbage after numeric 
addresses?

Mikulas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]