- fix crash when use wrong index bridge adapter;

This commit is contained in:
mtabachenko 2013-01-20 16:32:23 +00:00
parent e751cfb9bd
commit a1fbdd04a6
2 changed files with 16 additions and 2 deletions

View File

@ -2046,7 +2046,14 @@ static pcap_if_t * WIFI_index_device(pcap_if_t *alldevs, int index)
pcap_if_t *curr = alldevs;
for(int i = 0; i < index; i++)
{
if (curr->next == NULL)
{
CommonSettings.wifi.infraBridgeAdapter = i;
break;
}
curr = curr->next;
}
WIFI_LOG(2, "SoftAP: using %s as device.\n", curr->PCAP_DEVICE_NAME);
@ -2064,7 +2071,7 @@ bool SoftAP_Init()
char errbuf[PCAP_ERRBUF_SIZE];
pcap_if_t *alldevs;
int ret;
int ret = 0;
ret = driver->PCAP_findalldevs(&alldevs, errbuf);
if (ret == -1 || alldevs == NULL)

View File

@ -6143,7 +6143,14 @@ LRESULT CALLBACK WifiSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
cur = GetDlgItem(hDlg, IDC_BRIDGEADAPTER);
for(i = 0, d = alldevs; d != NULL; i++, d = d->next)
{
ComboBox_AddString(cur, d->description);
char buf[256] = {0};
// on x64 description is empty
if (d->description[0] == 0)
strcpy(buf, d->name);
else
strcpy(buf, d->description);
ComboBox_AddString(cur, buf);
}
ComboBox_SetCurSel(cur, CommonSettings.wifi.infraBridgeAdapter);
}