[PATCH] ws2_32: Implement GetHostNameW() function

Dmitry Timoshkov dmitry at baikal.ru
Mon Jun 1 07:25:51 CDT 2020


Vijay Kiran Kamuju <infyquest at gmail.com> wrote:

> +int WINAPI GetHostNameW(PWSTR name, int namelen)
> +{
> +    char *nameA = NULL;

Initialization to NULL is redundant.

> +    int ret;
> +
> +    TRACE("name %p, len %d\n", name, namelen);
> +
> +    if (!name)
> +    {
> +        SetLastError(WSAEFAULT);
> +        return SOCKET_ERROR;
> +    }
> +    if (name && (!(nameA = HeapAlloc(GetProcessHeap(), 0, namelen))))

'name' can't be NULL at this point. 'namelen' for a multibyte string
could be longer than length for a unicode one.

-- 
Dmitry.



More information about the wine-devel mailing list