diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-05-11 11:48:30 +0200 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-05-11 18:24:15 +0000 |
commit | becc442da9d16e09d7a961cf8b47262e9071e98d (patch) | |
tree | b18d48436b76afb3534d145ff18f328d0b0cb2ba /wsutil | |
parent | 17190a1ed29afaec671ba671ca66da0907c5be9c (diff) |
wsutil: fix WS_INET_ADDRSTRLEN definition on Windows
On Windows, epan/addr_resolv.c has a different definition of structures
"hashipv4_t" (and "hashipv6_t") because the size of the "ip" member is
dependent on "WS_INET_ADDRSTRLEN". A mismatch resulted in two different
structures where the "name" field got shifted (resulting in empty names
in the resolved addresses table due to leading nul bytes).
Since including ws2tcpip.h for the appropriate definition results in
various compile errors (config.h, packet-dcerpc-misc.h, ...) and the
larger definition is actually not needed, just use constants again.
Bug: 14667
Change-Id: I4f8b300eb977be55f16ac40cacc78a5549e2732f
Fixes: v2.5.0rc0-1503-gde1b26a3c6 ("More ws_inet_ntop() tweaks.")
Reviewed-on: https://code.wireshark.org/review/27453
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/inet_addr.h | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/wsutil/inet_addr.h b/wsutil/inet_addr.h index 267952f47b..378cf49b4e 100644 --- a/wsutil/inet_addr.h +++ b/wsutil/inet_addr.h @@ -13,10 +13,6 @@ #include "ws_symbol_export.h" #include "ws_attributes.h" -#ifdef HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif - #include <glib.h> #include "inet_ipv4.h" #include "inet_ipv6.h" @@ -48,18 +44,11 @@ * * At least they document inet_ntop() as requiring a 16-byte or larger * buffer for IPv4 addresses and a 46-byte or larger buffer for - * IPv6 addresses. + * IPv6 addresses. For this reason, use hard-coded numeric constants rather than + * INET_ADDRSTRLEN and INET6_ADDRSTRLEN. */ -#ifdef INET_ADDRSTRLEN - #define WS_INET_ADDRSTRLEN INET_ADDRSTRLEN -#else - #define WS_INET_ADDRSTRLEN 16 -#endif -#ifdef INET6_ADDRSTRLEN - #define WS_INET6_ADDRSTRLEN INET6_ADDRSTRLEN -#else - #define WS_INET6_ADDRSTRLEN 46 -#endif +#define WS_INET_ADDRSTRLEN 16 +#define WS_INET6_ADDRSTRLEN 46 /* * To check for errors set errno to zero before calling ws_inet_ntop{4,6}. |