From 1470d7b4cc607976b7d379d5ce594f65b3ca3c5b Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Thu, 9 Jan 2014 20:45:37 -0200 Subject: [PATCH] iphlpapi: Return error for IP address with value zero in IcmpSendEcho. --- dlls/iphlpapi/icmp.c | 5 +++++ dlls/iphlpapi/tests/iphlpapi.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c index 7d84811c9a5..abd8ddca22b 100644 --- a/dlls/iphlpapi/icmp.c +++ b/dlls/iphlpapi/icmp.c @@ -239,6 +239,11 @@ DWORD WINAPI IcmpSendEcho( } /* check the request size against SO_MAX_MSG_SIZE using getsockopt */ + if (!DestinationAddress) { + SetLastError(ERROR_INVALID_NETNAME); + return 0; + } + /* Prepare the request */ id=getpid() & 0xFFFF; seq=InterlockedIncrement(&icmp_sequence) & 0xFFFF; diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 94716d75400..13a21c0bf8e 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -906,12 +906,10 @@ todo_wine SetLastError(0xdeadbeef); ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000); error = GetLastError(); - todo_wine { ok (!ret, "IcmpSendEcho succeeded unexpectedly\n"); ok (error == ERROR_INVALID_NETNAME || broken(error == IP_BAD_DESTINATION) /* <= 2003 */, "expected 1214, got %d\n", error); - } address = htonl(INADDR_LOOPBACK); if (0) /* crashes in XP */ -- 2.11.4.GIT