diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2018-10-15 11:25:56 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2018-10-15 11:25:56 +0000 |
commit | 45f0844a034a63eb248970ba2a963e4ca7c91ed5 (patch) | |
tree | 8634e487078881761d50c4ecc14ba8997628636b /sbin/ifconfig/ifconfig.c | |
parent | 1fdd986d35eb5658162c34d3434674b7ecc53e59 (diff) |
The struct members addr and dstaddr in struct if_laddrreq are struct
sockaddr_storage which is guarantee to be large enough, no need to
check ai_addrlen. We can also trust the resolver to give us a
sockaddr_in6 sized object if we ask for AF_INET6
OK kn, deraadt
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index bde6d15f165..7c691c62328 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.379 2018/09/30 18:19:24 denis Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.380 2018/10/15 11:25:55 florian Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -3542,10 +3542,6 @@ settunnel(const char *src, const char *dst) errx(1, "source and destination address families do not match"); - if (srcres->ai_addrlen > sizeof(req.addr) || - dstres->ai_addrlen > sizeof(req.dstaddr)) - errx(1, "invalid sockaddr"); - memset(&req, 0, sizeof(req)); (void) strlcpy(req.iflr_name, name, sizeof(req.iflr_name)); memcpy(&req.addr, srcres->ai_addr, srcres->ai_addrlen); @@ -5879,8 +5875,6 @@ in6_getaddr(const char *s, int which) error = getaddrinfo(s, "0", &hints, &res); if (error) errx(1, "%s: %s", s, gai_strerror(error)); - if (res->ai_addrlen != sizeof(struct sockaddr_in6)) - errx(1, "%s: bad value", s); memcpy(sin6, res->ai_addr, res->ai_addrlen); #ifdef __KAME__ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && |