diff options
author | Ben Pfaff <blp@ovn.org> | 2017-11-27 09:20:57 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-12-21 16:12:01 -0800 |
commit | 8523fe9e412dfe07bb0d365eab77042ff54e85b0 (patch) | |
tree | e932f87ee51d441361d0caffe7dba635d9098d2c | |
parent | 51df0efb51a8bfd0d1480edbc504a888fc838998 (diff) | |
download | openvswitch-8523fe9e412dfe07bb0d365eab77042ff54e85b0.tar.gz |
odp-util: Avoid reading wrong table in generate_all_wildcard_mask().
These lines of code are intended to copy the 'next' and 'next_max' members
of tbl[type] into local variables 'tbl' and 'max':
tbl = tbl[type].next;
max = tbl[type].next_max;
They didn't do it properly because the first line changes 'tbl', so that
the first and seconds lines' references to tbl[type] refer to different
objects.
This commit fixes the problem.
Found by libfuzzer.
Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
-rw-r--r-- | lib/odp-util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c index b9e0ff986..4cd74fd2d 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -2606,8 +2606,9 @@ generate_all_wildcard_mask(const struct attr_len_tbl tbl[], int max, size_t nested_mask; if (tbl[type].next) { - tbl = tbl[type].next; - max = tbl[type].next_max; + const struct attr_len_tbl *entry = &tbl[type]; + tbl = entry->next; + max = entry->next_max; } nested_mask = nl_msg_start_nested(ofp, type); |