[0/2] posix: fix fnmatch() inconsistency BZ#30483

Message ID 20230523073732.6956-1-carenas@gmail.com
Headers
Series posix: fix fnmatch() inconsistency BZ#30483 |

Message

Carlo Arenas May 23, 2023, 7:37 a.m. UTC
  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(-)