[iproute PATCH] ip-route: Fix parse_encap_seg6() srh parsing

Subsystems: the rest

STALE2878d

2 messages, 2 authors, 2018-10-23 · open the first message on its own page

[iproute PATCH] ip-route: Fix parse_encap_seg6() srh parsing

From: Phil Sutter <phil@nwl.cc>
Date: 2018-10-18 21:45:32

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 <phil@nwl.cc>
---
 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 85045d4fff742..4ebfaa7cd6826 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;
-- 
2.19.0

Re: [iproute PATCH] ip-route: Fix parse_encap_seg6() srh parsing

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-10-23 01:27:32

On Thu, 18 Oct 2018 15:44:14 +0200
Phil Sutter [off-list ref] wrote:
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 <phil@nwl.cc>
Applied
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help