summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2023-04-21 10:05:49 -0700
committerStephen Hemminger <stephen@networkplumber.org>2023-04-21 10:05:49 -0700
commit067c8247fa07451816ea493e971da11319faa0f8 (patch)
treebdc8014a489ad3300155337028ef05af08a3f369
parentf666443f4bae700e8ce410d46018563b2de8bca6 (diff)
downloadiproute2-067c8247fa07451816ea493e971da11319faa0f8.tar.gz
lwtunnel: use sizeof() on segbuf
Avoid assuming that segbuf is 1024 bytes. Use sizeof() in places where it is being updated. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--ip/iproute_lwtunnel.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index d3100234..308178ef 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -961,7 +961,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
invarg("\"segs\" provided before \"mode\"\n",
*argv);
- strlcpy(segbuf, *argv, 1024);
+ strlcpy(segbuf, *argv, sizeof(segbuf));
} else if (strcmp(*argv, "hmac") == 0) {
NEXT_ARG();
if (hmac_ok++)
@@ -1047,7 +1047,7 @@ static int parse_encap_rpl(struct rtattr *rta, size_t len, int *argcp,
if (segs_ok++)
duparg2("segs", *argv);
- strlcpy(segbuf, *argv, 1024);
+ strlcpy(segbuf, *argv, sizeof(segbuf));
} else {
break;
}
@@ -1468,7 +1468,7 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
NEXT_ARG();
if (segs_ok++)
duparg2("segs", *argv);
- strlcpy(segbuf, *argv, 1024);
+ strlcpy(segbuf, *argv, sizeof(segbuf));
if (!NEXT_ARG_OK())
break;
NEXT_ARG();