aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-12-21 14:01:43 -0800
committerBen Pfaff <blp@nicira.com>2013-01-08 17:06:53 -0800
commit454276ac188eaf92d648e45b6e696e233882fcd4 (patch)
treeee282bc19533ff01bc911d36f6c0a22030b3fc8c
parent280532ae0143093fdd8e92eac0c0de0aad33c262 (diff)
meta-flow: Fix uninitialized data parsing tnl_flags in mf_parse().
Also, add an assertion that the field is the expected size. This bug was introduced in commit 2fdf762a006f (vswitchd: Log all tunnel parameters of given flow.) Found by valgrind. Bug #14357. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
-rw-r--r--lib/meta-flow.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 314ffc66..e6cc196a 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -2138,9 +2138,10 @@ out:
}
static char *
-mf_from_tun_flags_string(const char *s, ovs_be16 *valuep)
+mf_from_tun_flags_string(const char *s, ovs_be16 *valuep, ovs_be16 *maskp)
{
if (!parse_flow_tun_flags(s, flow_tun_flag_to_string, valuep)) {
+ *maskp = htons(UINT16_MAX);
return NULL;
}
@@ -2182,7 +2183,8 @@ mf_parse(const struct mf_field *mf, const char *s,
return mf_from_frag_string(s, &value->u8, &mask->u8);
case MFS_TNL_FLAGS:
- return mf_from_tun_flags_string(s, &value->be16);
+ assert(mf->n_bytes == sizeof(ovs_be16));
+ return mf_from_tun_flags_string(s, &value->be16, &mask->be16);
}
NOT_REACHED();
}