From: YAMAMOTO Takashi Date: Thu, 17 Oct 2013 15:51:23 +0000 (-0700) Subject: ofp-actions: Fix some ofpbuf usage problems in write-actions code. X-Git-Tag: sliver-openvswitch-2.0.90-1~7^2~56 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2b11907b156adbf2d9ce8f73405e2613467f07ab;p=sliver-openvswitch.git ofp-actions: Fix some ofpbuf usage problems in write-actions code. This code kept a pointer to data that might have been reallocated. For longer term, "nested" variants of some ofpact functions which using ofpbuf->l3 might be desirable. Signed-off-by: YAMAMOTO Takashi Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 06f9f6be5..a5b1090f0 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -1403,8 +1403,10 @@ ofpacts_pull_openflow11_instructions(struct ofpbuf *openflow, struct ofpact_nest *on; const union ofp_action *actions; size_t n_actions; - size_t start = ofpacts->size; + size_t start; + ofpact_pad(ofpacts); + start = ofpacts->size; on = ofpact_put(ofpacts, OFPACT_WRITE_ACTIONS, offsetof(struct ofpact_nest, actions)); get_actions_from_instruction(insts[OVSINST_OFPIT11_WRITE_ACTIONS], @@ -1414,6 +1416,7 @@ ofpacts_pull_openflow11_instructions(struct ofpbuf *openflow, if (error) { goto exit; } + on = ofpbuf_at_assert(ofpacts, start, sizeof *on); on->ofpact.len = ofpacts->size - start; } if (insts[OVSINST_OFPIT11_WRITE_METADATA]) {