ofp-actions: Assert variable actions have len>0.
authorJoe Stringer <joe@ovn.org>
Mon, 7 Mar 2016 23:36:36 +0000 (15:36 -0800)
committerJoe Stringer <joe@ovn.org>
Tue, 8 Mar 2016 00:30:13 +0000 (16:30 -0800)
Variable-length actions must have a nonzero length; if they don't,
something went wrong and we should bail out.

Suggested-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
lib/ofp-actions.c

index 905469b..702575d 100644 (file)
@@ -7405,7 +7405,7 @@ ofpact_finish(struct ofpbuf *ofpacts, struct ofpact *ofpact)
 
     ovs_assert(ofpact == ofpacts->header);
     len = (char *) ofpbuf_tail(ofpacts) - (char *) ofpact;
-    ovs_assert(len <= UINT16_MAX);
+    ovs_assert(len > 0 && len <= UINT16_MAX);
     ofpact->len = len;
     ofpbuf_padto(ofpacts, OFPACT_ALIGN(ofpacts->size));
 }