From 78b192007dbd536bb39494a7287796a318e12644 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 5 Mar 2009 17:34:42 -0800 Subject: [PATCH] secchan: Correctly maintain rule's number of actions. We were reallocating memory properly but not updating the "n_actions" member, which sometimes led to reading past the end of a block. This problem possibly caused segfaults, since the OpenFlow->ODP action translation code assumes that OpenFlow actions are prevalidated, and random memory is not necessarily valid OpenFlow actions :-) Spotted by Valgrind. --- secchan/ofproto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 906a6a5e..d42a259f 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -2215,6 +2215,7 @@ modify_flow(struct ofproto *p, const struct ofp_flow_mod *ofm, update_stats(rule, &odp_flow.stats); } rule = xrealloc(rule, rule_size(n_actions)); + rule->n_actions = n_actions; memcpy(rule->actions, ofm->actions, n_actions * sizeof *rule->actions); cls_rule_moved(&p->cls, &old_rule->cr, &rule->cr); } -- 2.30.2