mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
fix freerdp_assistance_parse_address_list parsing (#8147)
* fix remote assistance connection string1 parsing Fails to parse when connection string only has one host:port because there is no ";" character. Also when multiple host:port;host:port it skip first host:port and parses remaining host:port as ";host:port...end" of connection string: eg: ;192.168.93.138:49626;192.168.93.139:49627;192.168.93.140:49628 ;192.168.93.139:49627;192.168.93.140:49628 ;192.168.93.140:49628 * Update assistance.c * Update assistance.c * Update assistance.c
This commit is contained in:
@@ -180,30 +180,32 @@ static BOOL append_address(rdpAssistanceFile* file, const char* host, const char
|
||||
|
||||
static BOOL freerdp_assistance_parse_address_list(rdpAssistanceFile* file, char* list)
|
||||
{
|
||||
WLog_DBG(TAG, "freerdp_assistance_parse_address_list list=%s", list);
|
||||
|
||||
BOOL rc = FALSE;
|
||||
char* p;
|
||||
|
||||
if (!file || !list)
|
||||
return FALSE;
|
||||
|
||||
p = list;
|
||||
char* strp = list;
|
||||
char* s = ";";
|
||||
char* token;
|
||||
|
||||
while ((p = strchr(p, ';')) != NULL)
|
||||
// get the first token
|
||||
token = strtok(strp, s);
|
||||
|
||||
// walk through other tokens
|
||||
while (token != NULL)
|
||||
{
|
||||
char* q = strchr(p, ':');
|
||||
char* port = strchr(token, ':');
|
||||
*port = '\0';
|
||||
port++;
|
||||
|
||||
if (!q)
|
||||
if (!append_address(file, token, port))
|
||||
goto out;
|
||||
|
||||
*q = '\0';
|
||||
q++;
|
||||
|
||||
if (!append_address(file, p, q))
|
||||
goto out;
|
||||
|
||||
p = q;
|
||||
token = strtok(NULL, s);
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
out:
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user