[PATCH 1/2] iphlpapi: Use a standalone buffer in IcmpSendEcho().

Huw Davies huw at codeweavers.com
Thu Jun 21 05:49:18 CDT 2018


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 <zzhang at codeweavers.com>
> >> ---
> >>  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.



More information about the wine-devel mailing list