[core,settings] fix use of FreeRDP_TargetNetPorts

This commit is contained in:
Armin Novak 2023-02-01 09:40:36 +01:00 committed by Martin Fleisz
parent 818267bc80
commit 0c496681f5
2 changed files with 7 additions and 12 deletions

View File

@ -1570,7 +1570,7 @@ void* freerdp_settings_get_pointer_array_writable(const rdpSettings* settings, s
max = freerdp_settings_get_uint32(settings, FreeRDP_TargetNetAddressCount); max = freerdp_settings_get_uint32(settings, FreeRDP_TargetNetAddressCount);
if (offset >= max) if (offset >= max)
goto fail; goto fail;
return (void*)(uintptr_t)settings->TargetNetPorts[offset]; return &settings->TargetNetPorts[offset];
case FreeRDP_ClientTimeZone: case FreeRDP_ClientTimeZone:
max = 1; max = 1;
if (offset >= max) if (offset >= max)

View File

@ -975,19 +975,14 @@ static BOOL freerdp_settings_int_buffer_copy(rdpSettings* _settings, const rdpSe
} }
} }
if (settings->TargetNetPorts) const void* ports = freerdp_settings_get_pointer(settings, FreeRDP_TargetNetPorts);
if (ports)
{ {
_settings->TargetNetPorts = (UINT32*)calloc( const UINT32 nrports =
freerdp_settings_get_uint32(settings, FreeRDP_TargetNetAddressCount), freerdp_settings_get_uint32(settings, FreeRDP_TargetNetAddressCount);
sizeof(UINT32)); if (!freerdp_settings_set_pointer_len(_settings, FreeRDP_TargetNetPorts, ports,
nrports))
if (!_settings->TargetNetPorts)
goto out_fail; goto out_fail;
for (index = 0;
index < freerdp_settings_get_uint32(settings, FreeRDP_TargetNetAddressCount);
index++)
_settings->TargetNetPorts[index] = settings->TargetNetPorts[index];
} }
} }