kernel32: Fix GetComputerNameA to not count trailing NULL

Dmitry Timoshkov dmitry at codeweavers.com
Fri Mar 2 01:00:59 CST 2007


"Alasdair Sinclair" <alasdairs at dsl.pipex.com> wrote:

> GetComputerNameA shouldn't count the trailing NULL when returning the 
> buffer.



> --- a/dlls/kernel32/computername.c
> +++ b/dlls/kernel32/computername.c
> @@ -390,8 +390,7 @@ BOOL WINAPI GetComputerNameA(LPSTR name, LPDWORD size)
>         else 
>         {
>             WideCharToMultiByte ( CP_ACP, 0, nameW, -1, name, len, NULL, 0 );
> -            name[len] = 0;
> -            *size = len;
> +            *size = len - 1;
>             ret = TRUE;

This change requires a test case.

-- 
Dmitry.



More information about the wine-devel mailing list