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:29:11 +0000 (10:29 -0800)
commitc93f303add6046fa583477e0c0749fded42e6068
treee873fc7373146448b8800a4f39bcb2ce06b3f0b4
parent5ee65211bc5b7c4041fe051ce5136a19467ebf8f
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