[PATCH] Fix crash in rtnl_link_sriov_parse_vflist

Laine Stump laine at laine.org
Tue Jan 17 07:47:34 PST 2017


vf_vlan_info was incorrectly indexed with "len" (the length in bytes
of the entire vfinfo_list rather than list_len (the index of the
current end of the vf_vlan_info array)

This resolves https://github.com/thom311/libnl/issues/126
---
 lib/route/link/sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c
index acabf67..3721ae8 100644
--- a/lib/route/link/sriov.c
+++ b/lib/route/link/sriov.c
@@ -568,7 +568,7 @@ int rtnl_link_sriov_parse_vflist(struct rtnl_link *link, struct nlattr **tb) {
 			list_len = 0;
 			nla_for_each_nested(nla_list, t[IFLA_VF_VLAN_LIST],
 					    list_rem) {
-				vf_vlan_info[len] = nla_data(nla_list);
+				vf_vlan_info[list_len] = nla_data(nla_list);
 				list_len++;
 			}
 
-- 
2.9.3




More information about the libnl mailing list