提交 5217c2ec 编写于 作者: C chegar

8199166: Better interface lists

Reviewed-by: igerasim, mschoene, michaelm, rhalade
上级 61ee7378
...@@ -279,7 +279,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) ...@@ -279,7 +279,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
// But in rare case it fails, we allow 'char' to be displayed // But in rare case it fails, we allow 'char' to be displayed
curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1); curr->displayName = (char *)malloc(ifrowP->dwDescrLen + 1);
} else { } 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); curr->name = (char *)malloc(strlen(dev_name) + 1);
...@@ -322,7 +322,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) ...@@ -322,7 +322,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
free(curr); free(curr);
return -1; return -1;
} else { } else {
curr->displayName[wlen*(sizeof(wchar_t))] = '\0'; ((wchar_t *)curr->displayName)[wlen] = L'\0';
curr->dNameIsUnicode = TRUE; curr->dNameIsUnicode = TRUE;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册