Hi Matthias,
looks good to me.
In src/java.base/unix/native/libnet/NetworkInterface.c, lines 1019 and 1034,
I'd prefer if the style was:
if (addr == NULL) {
return 0;
}
Thanks
Christoph
From: net-dev <[email protected]> On Behalf Of Baesken, Matthias
Sent: Mittwoch, 9. Januar 2019 10:02
To: net-dev <[email protected]>
Cc: Robin Westberg <[email protected]>
Subject: [CAUTION] RE: RFR 8216355: missing NULL checks in libnet in interface
iteration and potential resource leak in getMacAddress
New webrev :
http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.2/
( I noticed that I accidentally deleted a line in the AIX coding so I brought
it back, and I updated the Copyright year info to 2019 ).
Best regards, Matthias
From: Baesken, Matthias
Sent: Mittwoch, 9. Januar 2019 09:36
To: net-dev <[email protected]<mailto:[email protected]>>
Cc: 'Robin Westberg'
<[email protected]<mailto:[email protected]>>
Subject: RFR 8216355: missing NULL checks in libnet in interface iteration and
potential resource leak in getMacAddress
Hello, please review the following fix .
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
Additionally a small resource leak in NetworkInterface.c is fixed.
Bug/webrev :
https://bugs.openjdk.java.net/browse/JDK-8216355
http://cr.openjdk.java.net/~mbaesken/webrevs/8216355.1/
Best regards, Matthias