From: Dave Seddon <dave.seddon.ca@gmail.com>
To: netdev@vger.kernel.org
Cc: Dave Seddon <dave.seddon.ca@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>,
David Ahern <dsahern@kernel.org>,
Paolo Lungaroni <paolo.lungaroni@uniroma2.it>
Subject: [PATCH iproute2] seg6local: fix crash when next-csid ends the command
Date: Mon, 23 Nov 2026 21:55:51 -0800 [thread overview]
Message-ID: <20261124055551.3390282-1-dave.seddon.ca@gmail.com> (raw)
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 <dave.seddon.ca@gmail.com>
---
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
reply other threads:[~2026-11-24 5:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124055551.3390282-1-dave.seddon.ca@gmail.com \
--to=dave.seddon.ca@gmail.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paolo.lungaroni@uniroma2.it \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox