public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: libc-alpha@sourceware.org
Cc: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH 0/2] posix: fix fnmatch() inconsistency BZ#30483
Date: Tue, 23 May 2023 00:37:30 -0700	[thread overview]
Message-ID: <20230523073732.6956-1-carenas@gmail.com> (raw)

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


             reply	other threads:[~2023-05-23  7:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  7:37 Carlo Marcelo Arenas Belón [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230523073732.6956-1-carenas@gmail.com \
    --to=carenas@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).