Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
Operating System: ReactOS
Platform: x86 Hardware
Description
If reactos\dll\win32\ws2_32\misc\ns.c:1286 inet_addr parameter cp (pointer to ipv4 address) is null the function crashes, because it tries to read at 0x00000000.
Testcase for win behaviour (needs to be linked against Ws2_32.lib):
#include <stdio.h>
#include <Winsock2.h>
int main(int argc, char* argv)
{
const char *addr = NULL;
unsigned long bin = inet_addr(addr);
printf("addr=%s, binary:%d, Error=%d\n", addr, bin, GetLastError());
getchar();
return 0;
}
inet_addr returns '-1' or '4294967295' for error and sets LastError to 10014/WSAEFAULT.
Filezilla uses this function with a null pointer (don't know why it does that though) and can't start on ros due to this crash.