public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] posix: fix fnmatch() inconsistency BZ#30483
@ 2023-05-23  7:37 Carlo Marcelo Arenas Belón
  2023-05-23  7:37 ` [PATCH 1/2] fnmatch: allow character class names with 'z' Carlo Marcelo Arenas Belón
  2023-05-23  7:37 ` [PATCH 2/2] posix: correctly detect invalid classes after match in fnmatch() Carlo Marcelo Arenas Belón
  0 siblings, 2 replies; 6+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2023-05-23  7:37 UTC (permalink / raw)
  To: libc-alpha; +Cc: Carlo Marcelo Arenas Belón

Always verify that the class name provided as part of the pattern
is a valid one before returning a result, so fnmatch() wouldn't
mistakenly return 0 if there was a match but the rest of the bracket
expression is not valid.

Note that for most other cases there were already hard failures and
class name that exceeds the maximum was one of those, so the lack of
hard failures might had been caused by the original copy and
adaptation of the code that matches the first expression.

First patch fixes an even older bug and that is partially covered
in the proposed fix for the issue that is included with the second.

I didn't include a regression test to try to keep the change minimal.

I did FSF copyright assignment for GNU grep before, if that is relevant
for this series.

Tested on x86_64-pc-linux-gnu

Carlo Marcelo Arenas Belón (2):
  fnmatch: allow character class names with 'z'
  posix: correctly detect invalid classes after match in fnmatch()

 posix/fnmatch_loop.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-26 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23  7:37 [PATCH 0/2] posix: fix fnmatch() inconsistency BZ#30483 Carlo Marcelo Arenas Belón
2023-05-23  7:37 ` [PATCH 1/2] fnmatch: allow character class names with 'z' Carlo Marcelo Arenas Belón
2023-05-23 18:09   ` Adhemerval Zanella Netto
2023-05-23 21:55     ` Carlo Arenas
2023-05-26 14:25       ` Adhemerval Zanella Netto
2023-05-23  7:37 ` [PATCH 2/2] posix: correctly detect invalid classes after match in fnmatch() Carlo Marcelo Arenas Belón

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).