[common,assist] fix file parser (Fixes #9726)

* only append N or U entry if it was found
* append port for N and U entries
This commit is contained in:
akallabeth 2024-01-04 10:28:48 +01:00 committed by Martin Fleisz
parent 33447dc16e
commit fbc25978ae

View File

@ -660,12 +660,20 @@ static BOOL freerdp_assistance_parse_all_elements_of_l(rdpAssistanceFile* file,
if (!freerdp_assistance_parse_attr(&u, &ulen, "U", data))
return FALSE;
if (!ArrayList_Append(file->MachineAddresses, strndup(n, nlen)))
return FALSE;
if (!ArrayList_Append(file->MachineAddresses, strndup(u, ulen)))
return FALSE;
if (!ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p))
return FALSE;
if (n && (nlen > 0))
{
if (!ArrayList_Append(file->MachineAddresses, strndup(n, nlen)))
return FALSE;
if (!ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p))
return FALSE;
}
if (u && (ulen > 0))
{
if (!ArrayList_Append(file->MachineAddresses, strndup(u, ulen)))
return FALSE;
if (!ArrayList_Append(file->MachinePorts, (void*)(uintptr_t)p))
return FALSE;
}
return TRUE;
}