diff options
author | kn <kn@cvs.openbsd.org> | 2018-10-14 11:00:57 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2018-10-14 11:00:57 +0000 |
commit | b9ab577727a3efa2d817d088a1a5493ab9cc1059 (patch) | |
tree | 78bfdc62f8dfcf2c775c5ea8c18eb580fc91a14c /sbin/ping | |
parent | 2aa01cadbef9b58ca38d2d55528079404ad47dbc (diff) |
Remove unneeded sockaddr size checks
With hints set appropiately and switching on address family, the actual
size of the socket address returned by getaddrinfo(3) and it's specified
length is guaranteed to match.
This is probably a leftover "from ping6 which was much more paranoid"
before merging it ping.
OK florian
Diffstat (limited to 'sbin/ping')
-rw-r--r-- | sbin/ping/ping.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 158de79ff6c..941e4fb5e9d 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping.c,v 1.228 2018/07/21 07:27:54 claudio Exp $ */ +/* $OpenBSD: ping.c,v 1.229 2018/10/14 11:00:56 kn Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -449,14 +449,10 @@ main(int argc, char *argv[]) switch (res->ai_family) { case AF_INET: - if (res->ai_addrlen != sizeof(dst4)) - errx(1, "size of sockaddr mismatch"); dst = (struct sockaddr *)&dst4; from = (struct sockaddr *)&from4; break; case AF_INET6: - if (res->ai_addrlen != sizeof(dst6)) - errx(1, "size of sockaddr mismatch"); dst = (struct sockaddr *)&dst6; from = (struct sockaddr *)&from6; break; @@ -488,8 +484,6 @@ main(int argc, char *argv[]) hints.ai_family = dst->sa_family; if ((error = getaddrinfo(source, NULL, &hints, &res))) errx(1, "%s: %s", source, gai_strerror(error)); - if (res->ai_addrlen != dst->sa_len) - errx(1, "size of sockaddr mismatch"); memcpy(from, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); |