[PATCH] advapi32: fixed second buffer argument to MBtoWC and WCtoMB

Alexandre Julliard julliard at winehq.org
Thu Feb 5 07:34:47 CST 2009


Marcus Meissner <marcus at jet.franken.de> writes:

> diff --git a/dlls/advapi32/cred.c b/dlls/advapi32/cred.c
> index 9ad4fb1..ab86ed6 100644
> --- a/dlls/advapi32/cred.c
> +++ b/dlls/advapi32/cred.c
> @@ -940,7 +940,8 @@ static void convert_PCREDENTIALW_to_PCREDENTIALA(const CREDENTIALW *CredentialW,
>      if (CredentialW->TargetName)
>      {
>          CredentialA->TargetName = buffer;
> -        string_len = WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, CredentialA->TargetName, -1, NULL, NULL);
> +        string_len = WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, NULL, 0, NULL, NULL);
> +                     WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, CredentialA->TargetName, string_len, NULL, NULL);

It doesn't make sense to use the output size as buffer size. You need to
pass the real size of the buffer.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list