patch 'app: remove use of strncpy' has been queued to stable release 24.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 13 19:18:04 CEST 2026


Hi,

FYI, your patch has been queued to stable release 24.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/15/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/f382087c0383676444a717f6937b3d32a7ad259d

Thanks.

Luca Boccassi

---
>From f382087c0383676444a717f6937b3d32a7ad259d Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Tue, 23 Jun 2026 15:50:27 +0100
Subject: [PATCH] app: remove use of strncpy

[ upstream commit d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca ]

Use of strncpy is not recommended, so replace it with strlcpy or memcpy
as appropriate.

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Fixes: 8ecd4048ba5d ("app/crypto-perf: fix string not null terminated")
Fixes: 0add6c27cd7c ("app/testeventdev: define the test options")
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Fixes: 1e8a4e97b057 ("app/testpmd: add flow dump command")
Fixes: de06137cb295 ("app/regex: add RegEx test application")

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 app/test-crypto-perf/cperf_options_parsing.c | 5 ++---
 app/test-dma-perf/main.c                     | 2 +-
 app/test-eventdev/evt_options.c              | 2 +-
 app/test-pmd/cmdline_flow.c                  | 2 +-
 app/test-regex/main.c                        | 9 ++-------
 5 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 8abee2d688..f8fed57b45 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -440,8 +440,7 @@ parse_device_type(struct cperf_options *opts, const char *arg)
 	if (strlen(arg) > (sizeof(opts->device_type) - 1))
 		return -1;
 
-	strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
-	*(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
+	strlcpy(opts->device_type, arg, sizeof(opts->device_type));
 
 	return 0;
 }
@@ -1062,7 +1061,7 @@ cperf_options_default(struct cperf_options *opts)
 	opts->segment_sz = 0;
 
 	opts->imix_distribution_count = 0;
-	strncpy(opts->device_type, "crypto_aesni_mb",
+	strlcpy(opts->device_type, "crypto_aesni_mb",
 			sizeof(opts->device_type));
 	opts->nb_qps = 1;
 
diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 25a79d1d6c..3446a661c6 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -221,7 +221,7 @@ parse_entry(const char *value, struct test_configure_entry *entry)
 	if (value == NULL || entry == NULL)
 		goto out;
 
-	strncpy(input, value, 254);
+	strlcpy(input, value, sizeof(input));
 	if (*input == '\0')
 		goto out;
 
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 323d1e724d..bdd9e63c17 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -23,7 +23,7 @@ evt_options_default(struct evt_options *opt)
 	memset(opt, 0, sizeof(*opt));
 	opt->verbose_level = 1; /* Enable minimal prints */
 	opt->dev_id = 0;
-	strncpy(opt->test_name, "order_queue", EVT_TEST_NAME_MAX_LEN);
+	strlcpy(opt->test_name, "order_queue", sizeof(opt->test_name));
 	opt->nb_flows = 1024;
 	opt->socket_id = SOCKET_ID_ANY;
 	opt->pool_sz = 16 * 1024;
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 2ab151ed8d..e7302af636 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -11807,7 +11807,7 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,
 	if (!ctx->object)
 		return len;
 	buf = (uint8_t *)ctx->object + arg_data->offset;
-	strncpy(buf, str, len);
+	memcpy(buf, str, len);
 	if (ctx->objmask)
 		memset((uint8_t *)ctx->objmask + arg_data->offset, 0xff, len);
 	return len;
diff --git a/app/test-regex/main.c b/app/test-regex/main.c
index acb834a8b4..81719f2e04 100644
--- a/app/test-regex/main.c
+++ b/app/test-regex/main.c
@@ -103,7 +103,6 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file,
 	char **argvopt;
 	int opt;
 	int opt_idx;
-	size_t len;
 	static struct option lgopts[] = {
 		{ "help",  0, 0, ARG_HELP},
 		/* Rules database file to load. */
@@ -133,20 +132,16 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file,
 				lgopts, &opt_idx)) != EOF) {
 		switch (opt) {
 		case ARG_RULES_FILE_NAME:
-			len = strnlen(optarg, MAX_FILE_NAME - 1);
-			if (len == MAX_FILE_NAME)
+			if (strlcpy(rules_file, optarg, MAX_FILE_NAME) >= MAX_FILE_NAME)
 				rte_exit(EXIT_FAILURE,
 					 "Rule file name to long max %d\n",
 					 MAX_FILE_NAME - 1);
-			strncpy(rules_file, optarg, MAX_FILE_NAME - 1);
 			break;
 		case ARG_DATA_FILE_NAME:
-			len = strnlen(optarg, MAX_FILE_NAME - 1);
-			if (len == MAX_FILE_NAME)
+			if (strlcpy(data_file, optarg, MAX_FILE_NAME) >= MAX_FILE_NAME)
 				rte_exit(EXIT_FAILURE,
 					 "Data file name to long max %d\n",
 					 MAX_FILE_NAME - 1);
-			strncpy(data_file, optarg, MAX_FILE_NAME - 1);
 			break;
 		case ARG_NUM_OF_JOBS:
 			*nb_jobs = atoi(optarg);
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-13 18:17:06.463986767 +0100
+++ 0024-app-remove-use-of-strncpy.patch	2026-07-13 18:17:05.602283346 +0100
@@ -1 +1 @@
-From d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca Mon Sep 17 00:00:00 2001
+From f382087c0383676444a717f6937b3d32a7ad259d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d9d3c1131bae7b4b29953489b3b71d6b2c7a88ca ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -27 +28 @@
-index 44c2a7173a..b1b0abbcbc 100644
+index 8abee2d688..f8fed57b45 100644
@@ -30 +31 @@
-@@ -482,8 +482,7 @@ parse_device_type(struct cperf_options *opts, const char *arg)
+@@ -440,8 +440,7 @@ parse_device_type(struct cperf_options *opts, const char *arg)
@@ -40 +41 @@
-@@ -1134,7 +1133,7 @@ cperf_options_default(struct cperf_options *opts)
+@@ -1062,7 +1061,7 @@ cperf_options_default(struct cperf_options *opts)
@@ -50 +51 @@
-index 4249dcfd3d..13bf07a764 100644
+index 25a79d1d6c..3446a661c6 100644
@@ -53,3 +54,3 @@
-@@ -220,7 +220,7 @@ parse_entry(const char *value, struct test_configure_entry *entry)
- 	int args_nr = -1;
- 	int ret;
+@@ -221,7 +221,7 @@ parse_entry(const char *value, struct test_configure_entry *entry)
+ 	if (value == NULL || entry == NULL)
+ 		goto out;
@@ -63 +64 @@
-index 0e70c971eb..1da0aba386 100644
+index 323d1e724d..bdd9e63c17 100644
@@ -76 +77 @@
-index e41ab0ef9b..fbbe36233b 100644
+index 2ab151ed8d..e7302af636 100644
@@ -79 +80 @@
-@@ -11911,7 +11911,7 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,
+@@ -11807,7 +11807,7 @@ parse_string0(struct context *ctx, const struct token *token __rte_unused,


More information about the stable mailing list