sspi/ntlm: integrate pull request comments

This commit is contained in:
Bernhard Miklautz 2015-06-19 10:38:37 +02:00
parent 1b8dd139a9
commit fc6a3cf3c1
2 changed files with 7 additions and 3 deletions

View File

@ -114,7 +114,7 @@ int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
DWORD nSize = MAX_COMPUTERNAME_LENGTH; DWORD nSize = MAX_COMPUTERNAME_LENGTH;
char* name = TargetName; char* name = TargetName;
if (!TargetName) if (!name)
{ {
if (!GetComputerNameExA(ComputerNameDnsHostname, computerName, &nSize)) if (!GetComputerNameExA(ComputerNameDnsHostname, computerName, &nSize))
@ -124,7 +124,7 @@ int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
if (!name) if (!name)
return -1; return -1;
CharUpperA(TargetName); CharUpperA(name);
} }
context->TargetName.pvBuffer = NULL; context->TargetName.pvBuffer = NULL;
@ -132,7 +132,8 @@ int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
if (status <= 0) if (status <= 0)
{ {
free(TargetName); if (!TargetName)
free(name);
return -1; return -1;
} }

View File

@ -188,7 +188,10 @@ int ntlm_get_target_computer_name(PUNICODE_STRING pName, COMPUTER_NAME_FORMAT ty
status = ConvertToUnicode(CP_UTF8, 0, name, -1, &pName->Buffer, 0); status = ConvertToUnicode(CP_UTF8, 0, name, -1, &pName->Buffer, 0);
if (status <= 0) if (status <= 0)
{
free(name);
return status; return status;
}
pName->Length = (USHORT)((status - 1) * 2); pName->Length = (USHORT)((status - 1) * 2);
pName->MaximumLength = pName->Length; pName->MaximumLength = pName->Length;