On input, the lpnSize [in, out] parameter for GetComputerNameEx()
specifies the total size of the buffer (in characters).
Several functions in ntlm.c were off by one which caused ntlm to fail
if the netbios hostname's strlen was exactly MAX_COMPUTERNAME_LENGTH.
int ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
{
int status;
- DWORD nSize = MAX_COMPUTERNAME_LENGTH;
char* ws = Workstation;
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD nSize = sizeof(computerName) * sizeof(CHAR);
if (!Workstation)
{
{
int status;
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD nSize = MAX_COMPUTERNAME_LENGTH;
+ DWORD nSize = sizeof(computerName) * sizeof(CHAR);
char* name = TargetName;
if (!name)
char* name;
int status;
CHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD nSize = MAX_COMPUTERNAME_LENGTH;
+ DWORD nSize = sizeof(computerName) * sizeof(CHAR);
if (!GetComputerNameExA(type, computerName, &nSize))
return -1;