JDK-8216355 : missing NULL checks in libnet in interface iteration and potential resource leak in getMacAddress
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 12,13
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2019-01-08
  • Updated: 2020-04-08
  • Resolved: 2019-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13
11.0.4Fixed 13 b04Fixed
Description
In NetworkInterface.c  and  Inet6AddressImpl.c  we have some coding that omits checking  for ifa_addr == NULL  when iterating on the result of the getifaddrs call.  This is similar  to  what has been fixed in hotspot with

https://bugs.openjdk.java.net/browse/JDK-8208676

The  issues are in the bsd/macOS coding.  However bsd/macOS  also document  that ifa_addr can be NULL in special cases (not sure how likely it is to see it "in the wild").
See  
https://www.freebsd.org/cgi/man.cgi?getifaddrs
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/getifaddrs.3.html  
Comments
Fix Request I would like to have the patch as well in jdk11, because the missing NULL check is present in jdk11 as well and could lead (on some platforms) to crashes. The patch applies cleanly.
15-03-2019