forked from osmocom/wireshark
We're using inet_pton(), so we don't need to worry about non-dotted-quad addresses.
inet_pton(), and thus ws_inet_pton(), won't accept hex or fewer-than-four-component IPv4 addresses, at least on Single UNIX Specification-compliant systems - the SUSv4 explicitly says The inet_pton() function does not accept other formats (such as the octal numbers, hexadecimal numbers, and fewer than four numbers that inet_addr() accepts). so we don't need to check for "inet_atons that accept strings such as - "130.230" as valid addresses". That also means that, "if there are any places where this needs to support the hex-address form for IPv4 addresses, or to support fewer than 4 components for a network address", those places were hosed even before we stopped using inet_aton(), so there are presumably no such places. (Itojun's comment was probably just an expression of general concern, rather than a note of a known problem.) Change-Id: Id16b6ebd3550dc3bf5a0fc283898a99b7abc163c Reviewed-on: https://code.wireshark.org/review/24057 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
14080744db
commit
4dc02b2fcf
|
@ -3128,11 +3128,6 @@ get_host_ipaddr(const char *host, guint32 *addrp)
|
|||
#endif
|
||||
|
||||
/*
|
||||
* XXX - if there are any places where this needs to support
|
||||
* the hex-address form for IPv4 addresses, or to support
|
||||
* fewer than 4 components for a network address, add that
|
||||
* wherever it's appropriate.
|
||||
*
|
||||
* XXX - are there places where this is used to translate something
|
||||
* that's *only* supposed to be an IPv4 address, and where it
|
||||
* *shouldn't* translate host names?
|
||||
|
@ -3176,15 +3171,6 @@ get_host_ipaddr(const char *host, guint32 *addrp)
|
|||
}
|
||||
return FALSE;
|
||||
#endif
|
||||
} else {
|
||||
/* Does the string really contain dotted-quad IP?
|
||||
* Check against inet_atons that accept strings such as
|
||||
* "130.230" as valid addresses and try to convert them
|
||||
* to some form of a classful (host.net) notation.
|
||||
*/
|
||||
unsigned int a0, a1, a2, a3;
|
||||
if (sscanf(host, "%u.%u.%u.%u", &a0, &a1, &a2, &a3) != 4)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue