ofp-print: Fix handling of zero-length actions.
authorBen Pfaff <blp@nicira.com>
Tue, 23 Nov 2010 21:10:30 +0000 (13:10 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 2 Dec 2010 22:57:58 +0000 (14:57 -0800)
Without this change, zero-length ofp_actions cause an infinite loop.

lib/ofp-print.c

index e3cae78..97fd065 100644 (file)
@@ -314,6 +314,11 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah,
         return -1;
     }
 
+    if (!len) {
+        ds_put_format(string, "***zero-length action***\n");
+        return 8;
+    }
+
     if ((len % OFP_ACTION_ALIGN) != 0) {
         ds_put_format(string,
                       "***action %"PRIu16" length not a multiple of %d***\n",