diff options
author | 2008-09-03 08:37:51 +0000 | |
---|---|---|
committer | 2008-09-03 08:37:51 +0000 | |
commit | 35468b76d35240d7c4a2c10c7ec599fbf408fc95 (patch) | |
tree | a56d273940451aaac01d10c8a5bbf91d1b0cfda7 | |
parent | devname -> devicename to prevent shadowing devname(3); ok marco@ (diff) | |
download | wireguard-openbsd-35468b76d35240d7c4a2c10c7ec599fbf408fc95.tar.xz wireguard-openbsd-35468b76d35240d7c4a2c10c7ec599fbf408fc95.zip |
Prevent a possible overflow when the sum of all demotion counters
gets bigger than 255. OK henning@
-rw-r--r-- | sys/netinet/ip_carp.c | 4 |
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 |