PR/41558: Stathis Kamperis: Treat a backslash followed by NUL as NUL, instead

of a backslash if FNM_NOESCAPE is not set. According to TOG: a backslash in
a pattern followed by any other character, will match that second character
in the string.
This commit is contained in:
christos 2012-03-25 16:31:23 +00:00
parent 14758c77e1
commit a105f91c05

View File

@ -1,4 +1,4 @@
/* $NetBSD: fnmatch.c,v 1.24 2011/01/31 19:10:18 christos Exp $ */
/* $NetBSD: fnmatch.c,v 1.25 2012/03/25 16:31:23 christos Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
#else
__RCSID("$NetBSD: fnmatch.c,v 1.24 2011/01/31 19:10:18 christos Exp $");
__RCSID("$NetBSD: fnmatch.c,v 1.25 2012/03/25 16:31:23 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -192,7 +192,7 @@ fnmatchx(const char *pattern, const char *string, int flags, size_t recursion)
case '\\':
if (!(flags & FNM_NOESCAPE)) {
if ((c = FOLDCASE(*pattern++, flags)) == EOS) {
c = '\\';
c = '\0';
--pattern;
}
}