From: jsg Date: Fri, 22 May 2015 01:30:27 +0000 (+0000) Subject: fix a non safe use of LIST_FOREACH with LIST_REMOVE X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=511c78a3153bf420463bf5ba1d08532244e2aa99;p=openbsd fix a non safe use of LIST_FOREACH with LIST_REMOVE ok claudio@ kettenis@ reyk@ --- diff --git a/usr.sbin/dvmrpd/rde_srt.c b/usr.sbin/dvmrpd/rde_srt.c index d646c2452f7..cb8c328eb60 100644 --- a/usr.sbin/dvmrpd/rde_srt.c +++ b/usr.sbin/dvmrpd/rde_srt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_srt.c,v 1.25 2010/09/02 14:03:21 sobrado Exp $ */ +/* $OpenBSD: rde_srt.c,v 1.26 2015/05/22 01:30:27 jsg Exp $ */ /* * Copyright (c) 2009 Michele Marchetto @@ -225,7 +225,7 @@ rt_remove(struct rt_node *r) return (-1); } - LIST_FOREACH(ds_nbr, &r->ds_list, entry) { + while ((ds_nbr = LIST_FIRST(&r->ds_list)) != NULL) { LIST_REMOVE(ds_nbr, entry); free(ds_nbr); }