Fixed freerdp_assistance_parse_address_list

* Return a proper error in case parsing fails.
* Don't duplicate string as we already operate on a duplicate.
This commit is contained in:
Armin Novak 2018-11-22 11:17:13 +01:00
parent 3f655db3c5
commit f904d84638
1 changed files with 3 additions and 10 deletions

View File

@ -179,21 +179,15 @@ static BOOL append_address(rdpAssistanceFile* file, const char* host, const char
return reallocate(file, host, p); return reallocate(file, host, p);
} }
static BOOL freerdp_assistance_parse_address_list(rdpAssistanceFile* file, const char* list) static BOOL freerdp_assistance_parse_address_list(rdpAssistanceFile* file, char* list)
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
char* p; char* p;
char* str;
if (!file || !list) if (!file || !list)
return FALSE; return FALSE;
str = _strdup(list); p = list;
if (!str)
return FALSE;
p = str;
while ((p = strchr(p, ';')) != NULL) while ((p = strchr(p, ';')) != NULL)
{ {
@ -213,8 +207,7 @@ static BOOL freerdp_assistance_parse_address_list(rdpAssistanceFile* file, const
rc = TRUE; rc = TRUE;
out: out:
free(str); return rc;
return TRUE;
} }
static BOOL freerdp_assistance_parse_connection_string1(rdpAssistanceFile* file) static BOOL freerdp_assistance_parse_connection_string1(rdpAssistanceFile* file)