Code Review Request for Bug #7089443

Darryl Mocek darryl.mocek at
Mon Dec 12 22:50:10 UTC 2011

Hello.  Please review this patch to fix InetAddress.getLocalHost fails 
if the host name is larger HOST_NAME_MAX.  The fix is to use strncpy, 
and supply the max length the host name can be, instead of using 
strcpy.  There is no test supplied for this fix as I was unable to set 
the host name larger then MAXHOSTNAMELEN on the Linux and Solaris 
machines I tried.  I tested the fix by adding code to Inet4AddressImpl.c 
to simulate a host name larger then MAXHOSTNAMELEN.

Webrev, can be found here:


More information about the core-libs-dev mailing list