There is no reason to restrict nSize to 2 the hostname can be empty on

UNIX-like machines.
This commit is contained in:
Mariusz Zaborski 2018-04-06 21:07:51 +02:00
parent a9ecd6a6cc
commit 00374382d9
3 changed files with 4 additions and 8 deletions

View File

@ -255,8 +255,7 @@ BOOL settings_get_computer_name(rdpSettings* settings)
DWORD nSize = 0;
CHAR* computerName;
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || (GetLastError() != ERROR_MORE_DATA) ||
(nSize < 2))
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || GetLastError() != ERROR_MORE_DATA)
return FALSE;
computerName = calloc(nSize, sizeof(CHAR));

View File

@ -52,8 +52,7 @@ static int ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
if (!Workstation)
{
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || (GetLastError() != ERROR_MORE_DATA) ||
(nSize < 2))
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || GetLastError() != ERROR_MORE_DATA)
return -1;
computerName = calloc(nSize, sizeof(CHAR));
@ -133,8 +132,7 @@ static int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
if (!name)
{
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || (GetLastError() != ERROR_MORE_DATA) ||
(nSize < 2))
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || GetLastError() != ERROR_MORE_DATA)
return -1;
computerName = calloc(nSize, sizeof(CHAR));

View File

@ -180,8 +180,7 @@ int ntlm_get_target_computer_name(PUNICODE_STRING pName, COMPUTER_NAME_FORMAT ty
DWORD nSize = 0;
CHAR* computerName;
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || (GetLastError() != ERROR_MORE_DATA) ||
(nSize < 2))
if (GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize) || GetLastError() != ERROR_MORE_DATA)
return -1;
computerName = calloc(nSize, sizeof(CHAR));