aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-10-25 12:58:55 -0700
committerGuy Harris <guy@alum.mit.edu>2017-10-25 19:59:30 +0000
commit4dc02b2fcfa97e953e1ffc2c1a13f35f4a132965 (patch)
tree4d04c45a32e53ccf25ab75868b44e29daadd58b9
parent14080744dba2c170b6bc718aef1c89e1e175eefe (diff)
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>
-rw-r--r--epan/addr_resolv.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 358f21f..3f3ef5a 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -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;