From: Ben Pfaff Date: Sun, 24 Jun 2012 05:34:39 +0000 (-0700) Subject: ofp-util: Avoid use-after-free in ofputil_encode_flow_mod(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=932ecd69e5b1b21d1df44404a60db5f73c3664b8;p=openvswitch ofp-util: Avoid use-after-free in ofputil_encode_flow_mod(). nx_put_match() can reallocate the ofpbuf's data so we need to reload the pointer. Found by inspection. Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 6d820b2f..cc3c9fdf 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1776,6 +1776,7 @@ ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm, nfm->cookie = fm->new_cookie; match_len = nx_put_match(msg, false, &fm->cr, fm->cookie, fm->cookie_mask); + nfm = msg->data; nfm->idle_timeout = htons(fm->idle_timeout); nfm->hard_timeout = htons(fm->hard_timeout); nfm->priority = htons(fm->cr.priority);