ip-route: Fix parse_encap_seg6() srh parsing

In case caller did not specify 'segs' parameter, parse_srh() would read
garbage while iterating over 'segbuf'. Avoid this by initializing
'segbuf' to an empty string.

Fixes: e8493916a8 ("iproute: add support for SR-IPv6 lwtunnel encapsulation")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Phil Sutter 2018-10-18 15:44:14 +02:00 committed by Stephen Hemminger
parent cdefe1d8e4
commit 3b5c5ef0a7
1 changed files with 1 additions and 1 deletions

View File

@ -494,7 +494,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
struct seg6_iptunnel_encap *tuninfo;
struct ipv6_sr_hdr *srh;
char **argv = *argvp;
char segbuf[1024];
char segbuf[1024] = "";
int argc = *argcp;
int encap = -1;
__u32 hmac = 0;