When decoding a variable-length action, if the length of the action
exceeds the length storable in a uint16_t then something has gone
terribly wrong. Assert that this is not the case.
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
void
ofpact_finish(struct ofpbuf *ofpacts, struct ofpact *ofpact)
{
void
ofpact_finish(struct ofpbuf *ofpacts, struct ofpact *ofpact)
{
ovs_assert(ofpact == ofpacts->header);
ovs_assert(ofpact == ofpacts->header);
- ofpact->len = (char *) ofpbuf_tail(ofpacts) - (char *) ofpact;
+ len = (char *) ofpbuf_tail(ofpacts) - (char *) ofpact;
+ ovs_assert(len <= UINT16_MAX);
+ ofpact->len = len;
ofpbuf_padto(ofpacts, OFPACT_ALIGN(ofpacts->size));
}
\f
ofpbuf_padto(ofpacts, OFPACT_ALIGN(ofpacts->size));
}
\f