summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-09-03 08:37:52 +0000
committerMarco Pfatschbacher <mpf@cvs.openbsd.org>2008-09-03 08:37:52 +0000
commit52bfe4263bba85ed7b573a8997450387785cd117 (patch)
tree6c5cb8138e162fc4f246b01a183a2ef81eaffd18 /sys/netinet/ip_carp.c
parent85b70707b968c854727d320dd6acc5714ffc6841 (diff)
Prevent a possible overflow when the sum of all demotion counters
gets bigger than 255. OK henning@
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 67868b7d243..bb61dd7d10f 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.167 2008/06/14 21:46:22 reyk Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.168 2008/09/03 08:37:51 mpf Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -2577,7 +2577,7 @@ carp_group_demote_count(struct carp_softc *sc)
TAILQ_FOREACH(ifgl, &sc->sc_if.if_groups, ifgl_next)
count += ifgl->ifgl_group->ifg_carp_demoted;
- return (count);
+ return (count > 255 ? 255 : count);
}
void