[PATCH] cfgfile: fix isspace() undefined behavior

Bruce Richardson bruce.richardson at intel.com
Thu Nov 5 10:32:37 CET 2026


On Thu, Oct 22, 2026 at 08:23:48PM +0800, Wei Chen wrote:
> 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")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Wei Chen <allen.chen at jaguarmicro.com>
> ---
>  lib/cfgfile/rte_cfgfile.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson at intel.com>


More information about the stable mailing list