forked from osmocom/wireshark
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>
This commit is contained in:
parent
17190a1ed2
commit
becc442da9
|
@ -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}.
|
||||
|
|
Loading…
Reference in New Issue