]> git.proxmox.com Git - mirror_ovs.git/commitdiff
odp-util: Initialize nsh_hdr in odp_nsh_hdr_from_attr
authorYifeng Sun <pkusunyifeng@gmail.com>
Thu, 18 Oct 2018 21:10:49 +0000 (14:10 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 23 Oct 2018 16:31:13 +0000 (09:31 -0700)
For function odp_nsh_hdr_from_attr, paramemter `attr` may not contain
all necessary OVS_NSH_KEY_ATTR_ to fully initialize data of nsh_hdr.
On return, nsh_hdr can contain uninitialized values in its fields.

This patch zeroes out nsh_hdr in the beginning in order to prevent it.

Reported-by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10863
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/odp-util.c

index 7705bb30ae2103a61308d48443264864c2b977f7..c31b96be0280749be6b3577b857a3a125b6fee2a 100644 (file)
@@ -2559,6 +2559,8 @@ odp_nsh_hdr_from_attr(const struct nlattr *attr,
     bool has_md1 = false;
     bool has_md2 = false;
 
+    memset(nsh_hdr, 0, size);
+
     NL_NESTED_FOR_EACH (a, left, attr) {
         uint16_t type = nl_attr_type(a);
         size_t len = nl_attr_get_size(a);