There is no reason to restrict nSize to 2 the hostname can be empty on
authorMariusz Zaborski <oshogbo@vexillium.org>
Fri, 6 Apr 2018 19:07:51 +0000 (21:07 +0200)
committerMariusz Zaborski <oshogbo@vexillium.org>
Fri, 6 Apr 2018 19:07:51 +0000 (21:07 +0200)
UNIX-like machines.

libfreerdp/core/settings.c
winpr/libwinpr/sspi/NTLM/ntlm.c
winpr/libwinpr/sspi/NTLM/ntlm_av_pairs.c

index 4d249eb..d76fb0c 100644 (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));
index e6ce48a..593558b 100644 (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));
index 68ecc1f..d593a0e 100644 (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));