Fixed a bug in the IP-address parser that could cause a connection error when using LAN.

merge-requests/1/head
Teuniz 2015-10-09 12:59:02 +02:00
rodzic 38c5efe628
commit 362af14c58
2 zmienionych plików z 28 dodań i 2 usunięć

Wyświetl plik

@ -33,7 +33,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.30_1509230941"
#define PROGRAM_VERSION "0.30_1510091258"
#define MAX_PATHLEN 4096

Wyświetl plik

@ -42,7 +42,7 @@ void UI_Mainwindow::open_settings_dialog()
void UI_Mainwindow::open_connection()
{
int n;
int i, j, n, len;
char str[1024] = {""},
dev_str[256] = {""},
@ -101,6 +101,32 @@ void UI_Mainwindow::open_connection()
goto OUT_ERROR;
}
len = strlen(dev_str);
if(len < 7)
{
sprintf(str, "No IP address set");
goto OUT_ERROR;
}
for(i=0; i<len; i++)
{
if(dev_str[i] == '0')
{
if((dev_str[i+1] != 0) && (dev_str[i+1] != '.'))
{
for(j=i; j<len; j++)
{
dev_str[j] = dev_str[j+1];
}
i--;
len--;
}
}
}
device = tmc_open_lan(dev_str);
if(device == NULL)
{