RFR 6594296: NetworkInterface.getHardwareAddress returns zero length byte array

Alan Bateman Alan.Bateman at oracle.com
Tue Apr 30 12:52:30 PDT 2013


On 30/04/2013 20:42, Chris Hegarty wrote:
> This is a conformance issue where getHardwareAddress may incorrectly 
> return a zero length byte array, rather than null. The spec allows for 
> null, in fact it requires it for such cases. The issue is reproducible 
> with newer versions of Windows, with IPv6 enabled.
>
> The problem is in 
> src/windows/native/java/net/NetworkInterface_winXP.c. 
> PhysicalAddressLength can be 0, in which case the byte array should 
> not be created, rather than creating a 0 length byte[].
>
> From msdn:
>   "PhysicalAddressLength
>
>    Type: DWORD
>
>    The length, in bytes, of the address specified in the
>    PhysicalAddress member. For interfaces that do not have
>    a data-link layer, this value is zero."
>
> Webrev:
>   http://cr.openjdk.java.net/~chegar/6594296/webrev.00/webrev/
>
> -Chris.
This looks okay to me.

-Alan



More information about the net-dev mailing list