summaryrefslogtreecommitdiff
path: root/usr.sbin/rtadvd/rtadvd.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-02 17:30:49 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-02 17:30:49 +0000
commitac70d5482471f4565461ee7fb18f7a2d96ac3e75 (patch)
treedf514301586c734cc0f82670c3c5d6c207d56f5f /usr.sbin/rtadvd/rtadvd.c
parent5864731fed1df714b6409752931a7ea94dc2759d (diff)
Don't use a flag value as index into the 2 element array on_off.
Fixes a segmentation fault. ok deraadt@
Diffstat (limited to 'usr.sbin/rtadvd/rtadvd.c')
-rw-r--r--usr.sbin/rtadvd/rtadvd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index 0c11fb2d2b2..e6268b2e66d 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtadvd.c,v 1.38 2008/11/21 23:44:04 tedu Exp $ */
+/* $OpenBSD: rtadvd.c,v 1.39 2011/03/02 17:30:48 bluhm Exp $ */
/* $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */
/*
@@ -841,20 +841,20 @@ ra_input(int len, struct nd_router_advert *ra,
if ((ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) !=
rai->managedflg) {
log_info("M flag inconsistent on %s: %s from %s, %s from us",
- rai->ifname, on_off[!rai->managedflg],
+ rai->ifname, on_off[rai->managedflg ? 0 : 1],
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
- on_off[rai->managedflg]);
+ on_off[rai->managedflg ? 1 : 0]);
inconsistent++;
}
/* O flag */
if ((ra->nd_ra_flags_reserved & ND_RA_FLAG_OTHER) !=
rai->otherflg) {
log_info("O flag inconsistent on %s: %s from %s, %s from us",
- rai->ifname, on_off[!rai->otherflg],
+ rai->ifname, on_off[rai->otherflg ? 0 : 1],
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
- on_off[rai->otherflg]);
+ on_off[rai->otherflg ? 1 : 0]);
inconsistent++;
}
/* Reachable Time */