From: Ben Pfaff Date: Fri, 6 Mar 2009 01:34:42 +0000 (-0800) Subject: secchan: Correctly maintain rule's number of actions. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78b192007dbd536bb39494a7287796a318e12644;p=openvswitch 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. --- 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); }