patch 'cfgfile: fix undefined behavior in whitespace stripping' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:52:34 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/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/9b5581b02d6d71acb20b7075c75e2608515e5728

Thanks.

Luca Boccassi

---
>From 9b5581b02d6d71acb20b7075c75e2608515e5728 Mon Sep 17 00:00:00 2001
From: Wei Chen <allen.chen at jaguarmicro.com>
Date: Thu, 22 Oct 2026 20:23:48 +0800
Subject: [PATCH] cfgfile: fix undefined behavior in whitespace stripping

[ upstream commit 4a76203b05137d59665f2256744894f7734e625c ]

The _strip() function passes a char directly to isspace(), which is
undefined behavior. The ctype functions require an int argument that is
either an unsigned char value or EOF, but char is signed by default on
x86 and ARM, so any byte >= 0x80 in the input is promoted to a negative
int and indexes the ctype table out of bounds.

Such bytes are reachable from a user-provided config file containing
UTF-8 or other non-ASCII content.

Cast the argument to unsigned char, as is already done in
app/test-bbdev/test_bbdev_vector.c and elsewhere.

Fixes: eaafbad419bf ("cfgfile: library to interpret config files")

Signed-off-by: Wei Chen <allen.chen at jaguarmicro.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
 lib/cfgfile/rte_cfgfile.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c
index b657157096..9e04a35764 100644
--- a/lib/cfgfile/rte_cfgfile.c
+++ b/lib/cfgfile/rte_cfgfile.c
@@ -89,16 +89,16 @@ _strip(char *str, unsigned len)
 	if (len == 0)
 		return 0;
 
-	if (isspace(str[len-1])) {
+	if (isspace((unsigned char)str[len-1])) {
 		/* strip trailing whitespace */
-		while (newlen > 0 && isspace(str[newlen - 1]))
+		while (newlen > 0 && isspace((unsigned char)str[newlen - 1]))
 			str[--newlen] = '\0';
 	}
 
-	if (isspace(str[0])) {
+	if (isspace((unsigned char)str[0])) {
 		/* strip leading whitespace */
 		int i, start = 1;
-		while (isspace(str[start]) && start < newlen)
+		while (isspace((unsigned char)str[start]) && start < newlen)
 			start++
 			; /* do nothing */
 		newlen -= start;
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:19.640325095 +0000
+++ 0080-cfgfile-fix-undefined-behavior-in-whitespace-strippi.patch	2026-11-16 22:52:16.540234862 +0000
@@ -1 +1 @@
-From 4a76203b05137d59665f2256744894f7734e625c Mon Sep 17 00:00:00 2001
+From 9b5581b02d6d71acb20b7075c75e2608515e5728 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 4a76203b05137d59665f2256744894f7734e625c ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
-index 6edd83b5b3..958cec6672 100644
+index b657157096..9e04a35764 100644
@@ -32 +33 @@
-@@ -97,16 +97,16 @@ _strip(char *str, unsigned len)
+@@ -89,16 +89,16 @@ _strip(char *str, unsigned len)


More information about the stable mailing list