Subject: getnameinfo(3) behavior on short string region

From: [email-masked]
Date: Wed, 03 Nov 1999 12:02:22 +0900

Hello, if you do the following:

	char h[2];
	getnameinfo(sa, sa->sa_len, h, sizeof(h), NULL, 0, NI_NUMERICHOST)

	getnameinfo from NRL code fills in 1 letter into the buffer (h)
	and returns without error. getnameinfo from KAME code will raise error
	(by returning non-zero).  Which behavior is more
	correct/natural/desired?  There's nothing said in RFC2553.

itojun
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: Jack McCann <[email-masked]>
Date: Wed, 3 Nov 1999 10:30:40 -0500 (EST)

>        correct/natural/desired?  There's nothing said in RFC2553.

The latest version of the X/Open Networking Services definition
for getnameinfo() contains this text:

	On successful completion, function getnameinfo() returns the
	node and service names, if requested, in the buffers provided. 
	The returned names are always null-terminated strings, and
	may be truncated if the actual values are longer than can be
	stored in the buffers provided.  If the returned values are
	to be used as part of any further name resolution (for example,
	passed to getaddrinfo()), callers must either provide buffers
	large enough to store any result possible on the system or must
	check for truncation and handle that case appropriately.

Coincidently, this text was introduced via a change request from NRL.
Unfortunately, there is no mechanism specified with which to accomplish
the "check for truncation".  If Craig Metz is listening perhaps he can
comment...

- Jack