On Mon, Jun 1, 2020 at 2:25 PM Dmitry Timoshkov dmitry@baikal.ru wrote:
Vijay Kiran Kamuju infyquest@gmail.com wrote:
+int WINAPI GetHostNameW(PWSTR name, int namelen) +{
- char *nameA = NULL;
Initialization to NULL is redundant.
I am getting warnings if we use it without initialization.
- 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.
Should the nameA be allocated the size of namelen*sizeof(WCHAR)?
-- Dmitry.