summary refs log tree commit diff
path: root/posix/fnmatch.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-27 09:01:47 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-27 09:01:47 +0000
commitc0e18e5ed018bb61dcd106bfeebf7dd923053b3f (patch)
tree49ac3d26f147a0da500b799b8f1aeb5580db84a5 /posix/fnmatch.c
parent8a495c09224fe1170d6d3725ead86bf3a6f7cf00 (diff)
downloadglibc-c0e18e5ed018bb61dcd106bfeebf7dd923053b3f.tar.gz
glibc-c0e18e5ed018bb61dcd106bfeebf7dd923053b3f.tar.xz
glibc-c0e18e5ed018bb61dcd106bfeebf7dd923053b3f.zip
(internal_fnmatch): Correctly reset string pointer in case of an invalid [[: expression.
Diffstat (limited to 'posix/fnmatch.c')
-rw-r--r--posix/fnmatch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c
index d31c375bd2..b147f47d36 100644
--- a/posix/fnmatch.c
+++ b/posix/fnmatch.c
@@ -130,7 +130,9 @@ extern int errno;
 /* Match STRING against the filename pattern PATTERN, returning zero if
    it matches, nonzero if not.  */
 static int
+#ifdef _LIBC
 internal_function
+#endif
 internal_fnmatch (const char *pattern, const char *string,
 		  int no_leading_period, int flags)
 {
@@ -295,6 +297,7 @@ internal_fnmatch (const char *pattern, const char *string,
 # if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
 		    wctype_t wt;
 # endif
+		    char *startp = p;
 
 		    for (;;)
 		      {
@@ -313,7 +316,7 @@ internal_fnmatch (const char *pattern, const char *string,
 			  {
 			    /* This cannot possibly be a character class name.
 			       Match it as a normal range.  */
-			    --p;
+			    p = startp;
 			    c = '[';
 			    goto normal_bracket;
 			  }