[PATCH 1/2] secur32: Fix handling of ANSI NTLM credentials

Hans Leidekker hans at codeweavers.com
Thu May 26 03:46:48 CDT 2016


On Thu, 2016-05-26 at 08:07 +0000, Alistair Leslie-Hughes wrote:
> --- a/dlls/secur32/ntlm.c
> +++ b/dlls/secur32/ntlm.c
> @@ -174,27 +174,74 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(
>                  if(pAuthData != NULL)
>                  {
>                      PSEC_WINNT_AUTH_IDENTITY_W auth_data = pAuthData;
> +                    LPWSTR domain = NULL, user = NULL, password = NULL;
> +                    int domain_len = 0, user_len = 0, password_len = 0;
>  
> -                    TRACE("Username is %s\n", debugstr_wn(auth_data->User, auth_data->UserLength));
> -                    TRACE("Domain name is %s\n", debugstr_wn(auth_data->Domain, auth_data->DomainLength));
> +                    if (auth_data->Flags & SEC_WINNT_AUTH_IDENTITY_ANSI)
> +                    {
> +                        if (auth_data->DomainLength)
> +                        {
> +                            domain_len = MultiByteToWideChar(CP_ACP, 0, (char *)auth_data->Domain,
> +                                                             auth_data->DomainLength, NULL, 0);
> +                            domain = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * domain_len);
> +                            MultiByteToWideChar(CP_ACP, 0, (char *)auth_data->Domain, auth_data->DomainLength,
> +                                                domain, domain_len);

Please check the result of HeapAlloc calls.





More information about the wine-devel mailing list