lib/odp-util: Only use expected_bit when set.
authorJarno Rajahalme <jrajahalme@nicira.com>
Fri, 6 Dec 2013 16:30:17 +0000 (08:30 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Fri, 6 Dec 2013 16:30:17 +0000 (08:30 -0800)
parse_l2_5_onward() previously used out of range 'expected_bit' when
it was called with no attrs, which happens when parsing a mask with
zero length.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/odp-util.c

index 0fd1c51..6dbc213 100644 (file)
@@ -2871,7 +2871,7 @@ parse_l2_5_onward(const struct nlattr *attrs[OVS_KEY_ATTR_MAX + 1],
     } else {
         goto done;
     }
-    if (is_mask) {
+    if (check_len > 0) { /* Happens only when 'is_mask'. */
         if (!is_all_zeros(check_start, check_len) &&
             flow->dl_type != htons(0xffff)) {
             return ODP_FIT_ERROR;