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 e3cae783168d83b0c1d73e75964e1e14f4817d02..97fd0653d8c3ae5212420e3c35c03d1903fc2b00 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",