From ffe33dd788af80a6645ab62b1df8e8f215b8902a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 25 Oct 2018 12:24:30 +0200 Subject: [PATCH] ip-route: Fix parse_encap_seg6() srh parsing Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1602555 Upstream Status: iproute2.git commit 3b5c5ef0a75a9 commit 3b5c5ef0a75a9f685e78cd25da78706b5077bd83 Author: Phil Sutter Date: Thu Oct 18 15:44:14 2018 +0200 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: e8493916a8ede ("iproute: add support for SR-IPv6 lwtunnel encapsulation") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- ip/iproute_lwtunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 85045d4..4ebfaa7 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -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; -- 1.8.3.1