From: Roy Marples Date: Sun, 21 Jun 2026 11:15:37 +0000 (+0100) Subject: ARP: Iterate over states safely as the cb could remove ours X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=HEAD;p=thirdparty%2Fdhcpcd.git ARP: Iterate over states safely as the cb could remove ours Reported by NVIDIA Project Vanessa --- diff --git a/src/arp.c b/src/arp.c index 9c318be2..0e559a9e 100644 --- a/src/arp.c +++ b/src/arp.c @@ -477,7 +477,7 @@ arp_announce(struct arp_state *astate) { struct iarp_state *state; struct interface *ifp; - struct arp_state *a2; + struct arp_state *a2, *an; int r; /* Cancel any other ARP announcements for this address. */ @@ -485,7 +485,7 @@ arp_announce(struct arp_state *astate) state = ARP_STATE(ifp); if (state == NULL) continue; - TAILQ_FOREACH(a2, &state->arp_states, next) { + TAILQ_FOREACH_SAFE(a2, &state->arp_states, next, an) { if (astate == a2 || a2->addr.s_addr != astate->addr.s_addr) continue;