diff options
author | 2018-09-30 18:19:24 +0000 | |
---|---|---|
committer | 2018-09-30 18:19:24 +0000 | |
commit | 47ed671298825fc1eafeabe72dd4ee0c6bb608b4 (patch) | |
tree | 0b7f44431a133b25d3d214f3495d2ff9dd859324 | |
parent | telnet argv parsing overflow; from YangX92 (diff) | |
download | wireguard-openbsd-47ed671298825fc1eafeabe72dd4ee0c6bb608b4.tar.xz wireguard-openbsd-47ed671298825fc1eafeabe72dd4ee0c6bb608b4.zip |
deny non-contiguous netmask
OK job@
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 79e6e2d2c27..bde6d15f165 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.378 2018/09/09 20:32:55 phessler Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.379 2018/09/30 18:19:24 denis Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -5760,6 +5760,9 @@ in_getaddr(const char *s, int which) else errx(1, "%s: bad value", s); } + if (which == MASK && (ntohl(sin->sin_addr.s_addr) & + (~ntohl(sin->sin_addr.s_addr) >> 1))) + errx(1, "%s: non-contiguous mask", s); } /* ARGSUSED */ |