Code Review 7024560: InetAddress.getLocalHost().getHostName() returns localhost for hostnames of length HOST_NAME_MAX
Chris Hegarty
chris.hegarty at oracle.com
Thu Mar 10 03:03:16 PST 2011
On 03/ 9/11 05:07 PM, Alan Bateman wrote:
> Chris Hegarty wrote:
>> :
>> I tested on a few different Linux machines and instrumented the error
>> handling code, it is definitely failing with ENAMETOOLONG.
> Okay, must be a glibc thing. The changes you have look okay to me but
> would be nice to ensure that the hostname is null-terminated (for
> platforms that don't fail with ENAMETOOLONG).
Yes, Solaris is also not clear on null termination either. Best to
ensure the hostname is null-terminated.
http://cr.openjdk.java.net/~chegar/7024560/webrev.01/webrev/
-Chris.
>
> -Alan
More information about the net-dev
mailing list