1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Sat, 2 Dec 2017 08:45:59 +0100
3 Subject: [PATCH] batctl: Handle allocation error in vlan_get_link_parse
5 The malloc could fail and return NULL. In this case, the processing of the
6 current interface index has to be stopped to avoid writing to NULL (which
7 would cause a segfault).
9 Fixes: d29288fe0583 ("batctl: implement vlan-to-link helper functions")
10 Signed-off-by: Sven Eckelmann <sven@narfation.org>
11 Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
13 Origin: upstream, https://git.open-mesh.org/batctl.git/commit/2ea390ce9bdda39d3c15bd9470009f56f42d5ed9
16 1 file changed, 3 insertions(+)
18 diff --git a/functions.c b/functions.c
19 index 1c96e6241d01b83a136ff135bee8dd780629f7aa..f91f26f4045766474d5dc109d76e20afd91a7791 100644
22 @@ -812,6 +812,9 @@ static int vlan_get_link_parse(struct nl_msg *msg, void *arg)
23 idx = *(int *)nla_data(tb[IFLA_LINK]);
25 nl_arg->iface = malloc(IFNAMSIZ + 1);
29 if (!if_indextoname(idx, nl_arg->iface))