Nice find Kurchi,
It is surprising to me that we are building Solaris without LIFNAMSIZ
defined, but I accept that we are. Your changes look good to me.
-Chris.
On 05/02/2013 01:03 AM, Kurchi Subhra Hazra wrote:
Hi,
NetworkInterface.getByInetAddress() was crashing on solaris when the
system had a network
interface name longer than 15 characters, due to two instances in the
native
code for NetworkInterface where we were copying a char array of size 32
(LIFNAMSIZ)
into a char array of size 16 (IFNAMSIZ), resulting in a buffer overflow
with long names.
The fix is to make sure that the space allocated for the interface name
is consistent (16/32
bytes depending on the system), and to prevent overflows by using
strncpy instead of strcpy.
Bug: http://bugs.sun.com/view_bug.do?bug_id=8013140
Webrev: http://cr.openjdk.java.net/~khazra/8013140/webrev.00/
Thanks,
- Kurchi