From: Huw Davies Subject: Re: [PATCH 1/2] iphlpapi: Use a standalone buffer in IcmpSendEcho(). Message-Id: <20180621104915.GA9115@merlot.physics.ox.ac.uk> Date: Thu, 21 Jun 2018 11:49:18 +0100 In-Reply-To: <6d4cb499-a5d5-ac77-5a42-5252fefb93b6@codeweavers.com> References: <20180621093512.GA8507@merlot.physics.ox.ac.uk> <6d4cb499-a5d5-ac77-5a42-5252fefb93b6@codeweavers.com> On Thu, Jun 21, 2018 at 05:51:13PM +0800, Zhiyi Zhang wrote: > > > On Thu 6 21 17:35, Huw Davies wrote: > > On Fri, Jun 15, 2018 at 12:23:23PM +0800, Zhiyi Zhang wrote: > >> Fix https://bugs.winehq.org/show_bug.cgi?id=43252 > >> > >> The old implementation uses user provided buffer to receive > >> packet data, which is alway not enough, causing data corruptions > >> or incorrectly timeout. > >> > >> Signed-off-by: Zhiyi Zhang > >> --- > >> dlls/iphlpapi/icmp.c | 38 +++++++++++++++++++++++++++------- > >> dlls/iphlpapi/tests/iphlpapi.c | 21 +++++++++++++++---- > >> 2 files changed, 47 insertions(+), 12 deletions(-) > >> > >> diff --git a/dlls/iphlpapi/icmp.c b/dlls/iphlpapi/icmp.c > >> index ebc2f2b65c..7c91443598 100644 > >> --- a/dlls/iphlpapi/icmp.c > >> +++ b/dlls/iphlpapi/icmp.c > >> @@ -113,6 +113,9 @@ typedef struct { > >> #define IP_OPTS_DEFAULT 1 > >> #define IP_OPTS_CUSTOM 2 > >> > >> +#define MAXIPLEN 60 > >> +#define MAXICMPLEN 76 > > > > Out of interest, how did you get to 76? > > > > That was copied from https://github.com/iputils/iputils/blob/master/ping.c#L76 I guess it's for errors: 8 for the icmp header, 60 for the original ip header, then 8 for the original icmp header. We probably don't need all of that, but it doesn't hurt. Huw.