From 89c51948ffb149f65b09d30418b5fa4e1b9f3ba0 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Thu, 30 May 2019 18:10:34 +0100 Subject: [PATCH] 8225060: java.net.DefaultInterface invokes NetworkInterface::getInetAddresses without doPriv Reviewed-by: alanb --- .../macosx/classes/java/net/DefaultInterface.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java.base/macosx/classes/java/net/DefaultInterface.java b/src/java.base/macosx/classes/java/net/DefaultInterface.java index b68e3aa0034..5e5d00728d6 100644 --- a/src/java.base/macosx/classes/java/net/DefaultInterface.java +++ b/src/java.base/macosx/classes/java/net/DefaultInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,8 @@ package java.net; * that returns null. */ +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Enumeration; import java.io.IOException; @@ -82,7 +84,8 @@ class DefaultInterface { continue; boolean ip4 = false, ip6 = false; - Enumeration addrs = ni.getInetAddresses(); + PrivilegedAction> pa = ni::getInetAddresses; + Enumeration addrs = AccessController.doPrivileged(pa); while (addrs.hasMoreElements()) { InetAddress addr = addrs.nextElement(); if (!addr.isAnyLocalAddress()) {