8199166: Better interface lists
authorchegar
Fri, 10 Aug 2018 14:35:44 +0100
changeset 53316 066d2261108f
parent 53315 3d4e47348142
child 53317 5deff84a4d48
8199166: Better interface lists Reviewed-by: igerasim, mschoene, michaelm, rhalade
src/java.base/windows/native/libnet/NetworkInterface.c
--- a/src/java.base/windows/native/libnet/NetworkInterface.c	Sun Aug 12 18:05:16 2018 -0400
+++ b/src/java.base/windows/native/libnet/NetworkInterface.c	Fri Aug 10 14:35:44 2018 +0100
@@ -273,7 +273,7 @@
                 // But in rare case it fails, we allow 'char' to be displayed
                 curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1);
             } else {
-                curr->displayName = (wchar_t *)malloc(wlen*(sizeof(wchar_t))+1);
+                curr->displayName = (wchar_t *)malloc((wlen+1)*sizeof(wchar_t));
             }
 
             curr->name = (char *)malloc(strlen(dev_name) + 1);
@@ -316,7 +316,7 @@
                 free(curr);
                 return -1;
             } else {
-                curr->displayName[wlen*(sizeof(wchar_t))] = '\0';
+                ((wchar_t *)curr->displayName)[wlen] = L'\0';
                 curr->dNameIsUnicode = TRUE;
             }
         }