[PATCH] ws2_32: Implement GetHostNameW() function
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49286 Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
Vijay Kiran Kamuju <infyquest(a)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.
On Mon, Jun 1, 2020 at 2:25 PM Dmitry Timoshkov <dmitry(a)baikal.ru> wrote:
Vijay Kiran Kamuju <infyquest(a)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.
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72565 Your paranoid android. === wxppro (32 bit report) === ws2_32: sock: Timeout === w2008s64 (32 bit report) === ws2_32: sock: Timeout === w2008s64 (64 bit report) === ws2_32: sock: Timeout
participants (3)
-
Dmitry Timoshkov -
Marvin -
Vijay Kiran Kamuju