changeset 13344:891ef8bac57a

8199166: Better interface lists Reviewed-by: igerasim, mschoene, michaelm, rhalade
author chegar
date Fri, 10 Aug 2018 14:35:44 +0100
parents 5efb6688cd9e
children 423d88f93de7
files src/windows/native/java/net/NetworkInterface.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/java/net/NetworkInterface.c	Mon Aug 27 19:35:47 2018 +0100
+++ b/src/windows/native/java/net/NetworkInterface.c	Fri Aug 10 14:35:44 2018 +0100
@@ -279,7 +279,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);
@@ -322,7 +322,7 @@
                 free(curr);
                 return -1;
             } else {
-                curr->displayName[wlen*(sizeof(wchar_t))] = '\0';
+                ((wchar_t *)curr->displayName)[wlen] = L'\0';
                 curr->dNameIsUnicode = TRUE;
             }
         }