> -----Original Message-----
> From: Richardson, Bruce <[email protected]>
> Sent: Thursday, November 5, 2026 9:33 AM
> To: Wei Chen <[email protected]>
> Cc: [email protected]; Dumitrescu, Cristian <[email protected]>;
> [email protected]
> Subject: Re: [PATCH] cfgfile: fix isspace() undefined behavior
> 
> 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: [email protected]
> >
> > Signed-off-by: Wei Chen <[email protected]>
> > ---
> >  lib/cfgfile/rte_cfgfile.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> Acked-by: Bruce Richardson <[email protected]>

Acked-by: Cristian Dumitrescu <[email protected]>

Reply via email to