Bug 19816

Summary: getnameinfo() dumps core on 131.118.32.4
Product: Base System Reporter: Bill Fenner <fenner>
Component: binAssignee: Hajimu UMEMOTO <ume>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   

Description Bill Fenner 2000-07-10 06:30:03 UTC
	
getnameinfo() dumps core on 131.118.32.4
It assumes that getipnodebyaddr() can not return an hp->h_name of NULL.
However, it can, with the odd PTR record that 131.118.32.4 has:

4.32.118.131.in-addr.arpa.  1D IN PTR  .

I don't know if this is a bug in getipnodebyaddr() or getnameinfo().

Fix: 

Unknown.
Workaround: don't try to look up this IP address using getnameinfo().
How-To-Repeat: 
	

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

int
main(int argc,char **argv)
{
	struct sockaddr_in sin;
	char _hostname[256];

	sin.sin_family = AF_INET;
	sin.sin_len = sizeof(sin);
	sin.sin_addr.s_addr = inet_addr("131.118.32.4");

	getnameinfo((struct sockaddr*)&sin, sin.sin_len,
		      _hostname, sizeof(_hostname) - 1, NULL, 0,
		      NI_NAMEREQD);
}
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-10 13:11:15 UTC
Responsible Changed
From-To: freebsd-bugs->shin

Over to Inoue-san, whose code this seems to be.
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-18 15:17:09 UTC
Responsible Changed
From-To: shin->ume

Inoue-san seems unavailable at the moment.
Comment 3 Hajimu UMEMOTO freebsd_committer freebsd_triage 2000-07-19 07:22:51 UTC
State Changed
From-To: open->closed

It should be corrected by getipnodebyaddr() side and committed. 
(libc/net/name6.c rev 1.14) 
Thank you for reporting it.