[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:
akallabeth
2024-12-16 17:11:54 +01:00
parent 782974a3e4
commit 91ae892f91
3 changed files with 5 additions and 5 deletions

View File

@@ -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;
}