提交 6173b98f 编写于 作者: C chegar

8058216: NetworkInterface.getHardwareAddress can return zero length byte array...

8058216: NetworkInterface.getHardwareAddress can return zero length byte array when run with preferIPv4Stack
Reviewed-by: michaelm
上级 65414e1f
......@@ -1014,9 +1014,11 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0
case MIB_IF_TYPE_FDDI:
case IF_TYPE_IEEE80211:
len = ifRowP->dwPhysAddrLen;
ret = (*env)->NewByteArray(env, len);
if (!IS_NULL(ret)) {
(*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *) ifRowP->bPhysAddr);
if (len > 0) {
ret = (*env)->NewByteArray(env, len);
if (!IS_NULL(ret)) {
(*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *) ifRowP->bPhysAddr);
}
}
break;
}
......
......@@ -22,7 +22,9 @@
*/
/* @test
* @bug 4405354 6594296
* @bug 4405354 6594296 8058216
* @run main Test
* @run main/othervm -Djava.net.preferIPv4Stack=true Test
* @summary Basic tests for NetworkInterface
*/
import java.net.NetworkInterface;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册