ip crashes when "flavors next-csid" ends the command, with or without "lblen N": ip -6 route add 2001:db8:2::/64 dev lo encap seg6local action End \ flavors next-csid seg6local_parse_flavors() steps past the last argument and passes the NULL terminator to strcmp(). Check argc first. Fixes: 04a6b456bf74 ("seg6: add support for flavors in SRv6 End* behaviors") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Dave Seddon --- ip/iproute_lwtunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 9a1e747c..53004b5f 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -1434,7 +1434,7 @@ static int seg6local_parse_flavors(struct rtattr *rta, size_t len, if (flavors & (1 << SEG6_LOCAL_FLV_OP_NEXT_CSID)) { NEXT_ARG_FWD(); - if (strcmp(*argv, "lblen") == 0){ + if (argc > 0 && strcmp(*argv, "lblen") == 0) { NEXT_ARG(); if (lbl_ok++) duparg2("lblen", *argv); @@ -1444,7 +1444,7 @@ static int seg6local_parse_flavors(struct rtattr *rta, size_t len, NEXT_ARG_FWD(); } - if (strcmp(*argv, "nflen") == 0){ + if (argc > 0 && strcmp(*argv, "nflen") == 0) { NEXT_ARG(); if (nfl_ok++) duparg2("nflen", *argv); -- 2.56.0