[ovs-dev] [PATCH] ofp-actions: Assert variable actions have len>0.

Joe Stringer joe at ovn.org
Mon Mar 7 23:36:36 UTC 2016


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 at ovn.org>
Signed-off-by: Joe Stringer <joe at ovn.org>
---
 lib/ofp-actions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index a7c0388adeaa..e5fe8e608986 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -7407,7 +7407,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 && len <= UINT16_MAX);
     ofpact->len = len;
     ofpbuf_padto(ofpacts, OFPACT_ALIGN(ofpacts->size));
 
-- 
2.1.4




More information about the dev mailing list