nx-match: Correct writing of value and length in set_field_to_ofast()
authorSimon Horman <horms@verge.net.au>
Wed, 27 Feb 2013 07:12:16 +0000 (16:12 +0900)
committerBen Pfaff <blp@nicira.com>
Thu, 28 Feb 2013 18:32:20 +0000 (10:32 -0800)
commitcadf201365b9e1e35001579a0020b26d3b605116
treebf9178d1b43fadf00d8820602fc892195c60939c
parenta83d19d7581c083b84a611a1bf4286989656f52c
nx-match: Correct writing of value and length in set_field_to_ofast()

ofpbuf_put_* may reallocate the underlying buffer of the ofpbuf and
thus writing data after a ofpbuf_put_* call must write to memory
relative to the pointer returned by the call.

Prior to this change the length and trailing value would not be written to
the set_field action if ofpbuf_put_* may reallocated the underlying buffer.

Also make use of ofpbuf_put_zero() to avoid calling memset() directly.

Tested-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/nx-match.c