From 2b11907b156adbf2d9ce8f73405e2613467f07ab Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 17 Oct 2013 08:51:23 -0700 Subject: [PATCH] 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 --- lib/ofp-actions.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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]) { -- 2.47.0