[resent] Fix some hackish usages of WideCharToMultiByte

Alexandre Julliard julliard at winehq.org
Thu Jul 31 07:00:48 CDT 2008


"Colin Finck" <mail at colinfinck.de> writes:

> @@ -947,7 +947,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);
> +        /* Buffer is guaranteed to be large enough */
> +        string_len = WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, CredentialA->TargetName, 0x7FFFFFFF, NULL, NULL);

It would be cleaner to pass the actual buffer size to the function, it's
complex enough that it would be easy to inadvertently break the
guarantee that the allocated space is large enough.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list