From 5abfe44dd739dbd68113f8e5eeb03207e562719e Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 22 May 2015 01:34:13 +0000 Subject: [PATCH] fix a non safe use of TAILQ_FOREACH with TAILQ_REMOVE ok reyk@ --- usr.sbin/relayd/relay_http.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c index 2fdb2d56a7a..557b5fd783a 100644 --- a/usr.sbin/relayd/relay_http.c +++ b/usr.sbin/relayd/relay_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay_http.c,v 1.46 2015/05/18 16:57:20 bluhm Exp $ */ +/* $OpenBSD: relay_http.c,v 1.47 2015/05/22 01:34:13 jsg Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -1376,7 +1376,7 @@ relay_match_actions(struct ctl_relay_event *cre, struct relay_rule *rule, struct kvlist *matches, struct kvlist *actions) { struct rsession *con = cre->con; - struct kv *kv; + struct kv *kv, *tmp; /* * Apply the following options instantly (action per match). @@ -1395,7 +1395,7 @@ relay_match_actions(struct ctl_relay_event *cre, struct relay_rule *rule, */ if (matches == NULL) { /* 'pass' or 'block' rule */ - TAILQ_FOREACH(kv, &rule->rule_kvlist, kv_rule_entry) { + TAILQ_FOREACH_SAFE(kv, &rule->rule_kvlist, kv_rule_entry, tmp) { TAILQ_INSERT_TAIL(actions, kv, kv_action_entry); TAILQ_REMOVE(&rule->rule_kvlist, kv, kv_rule_entry); } -- 2.20.1