mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr,sysinfo] fix use of GetComputerNameExA
The buffer must be large enough to hold MAX_COMPUTERNAME_LENGTH characters, so the buffer needs to be of size MAX_COMPUTERNAME_LENGTH + 1 or larger to hold the '\0' terminated string.
This commit is contained in:
@@ -1165,7 +1165,7 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
|
||||
name = freerdp_settings_get_string(settings, FreeRDP_ComputerName);
|
||||
if (!name)
|
||||
{
|
||||
DWORD size = sizeof(rdpdr->computerName) - 1;
|
||||
DWORD size = ARRAYSIZE(rdpdr->computerName);
|
||||
if (!GetComputerNameExA(ComputerNameNetBIOS, rdpdr->computerName, &size))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user