summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-03-26 15:38:40 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-03-26 15:38:40 +0000
commitbae575d3e87dc4185267b4e660a35ec9c3750abc (patch)
treee779006661a2b6a992c3ed338ab37f946b50536a
parent8a8616dbcbe3af0e9545f11ac05a0b778737a5f3 (diff)
Be more careful when walking the tree looking for a non-empty element,
we may actually hit the end of the tree (at least in theory).
-rw-r--r--usr.sbin/bgpd/rde_rib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 7120cc1c364..db17366ed1e 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.121 2010/03/03 13:52:39 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.122 2010/03/26 15:38:39 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -310,7 +310,7 @@ rib_restart(struct rib_context *ctx)
re->flags &= ~F_RIB_ENTRYLOCK;
/* find first non empty element */
- while (rib_empty(re))
+ while (re && rib_empty(re))
re = RB_NEXT(rib_tree, unused, re);
/* free the previously locked rib element if empty */