summary refs log tree commit diff
path: root/posix/fnmatch_loop.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-10-12 17:47:19 +0000
committerUlrich Drepper <drepper@redhat.com>2007-10-12 17:47:19 +0000
commitb7d1c5fa30247da1911913452b0ba89195638701 (patch)
tree3e43af2f95fb245cd0460f0418400d8773e4b4a0 /posix/fnmatch_loop.c
parentd074d36dde3140ba9b09555760dcbd503405d0f3 (diff)
downloadglibc-b7d1c5fa30247da1911913452b0ba89195638701.tar.gz
glibc-b7d1c5fa30247da1911913452b0ba89195638701.tar.xz
glibc-b7d1c5fa30247da1911913452b0ba89195638701.zip
* posix/fnmatch_loop.c: Take rule index returned as part of
	findidx return value into account when accessing weights.
	* posix/regcomp.c: Likewise.
	* posix/regexec.c: Likewise.
Diffstat (limited to 'posix/fnmatch_loop.c')
-rw-r--r--posix/fnmatch_loop.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
index 2bdd837184..67c0ee4abb 100644
--- a/posix/fnmatch_loop.c
+++ b/posix/fnmatch_loop.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2003,2004,2005,
-   2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1996-2001,2003-2005,2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -418,15 +418,20 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends)
 			    /* We found a table entry.  Now see whether the
 			       character we are currently at has the same
 			       equivalance class value.  */
-			    int len = weights[idx];
+			    int len = weights[idx & 0xffffff];
 			    int32_t idx2;
 			    const UCHAR *np = (const UCHAR *) n;
 
 			    idx2 = findidx (&np);
-			    if (idx2 != 0 && len == weights[idx2])
+			    if (idx2 != 0
+				&& (idx >> 24) == (idx2 >> 24)
+				&& len == weights[idx2 & 0xffffff])
 			      {
 				int cnt = 0;
 
+				idx &= 0xffffff;
+				idx2 &= 0xffffff;
+
 				while (cnt < len
 				       && (weights[idx + 1 + cnt]
 					   == weights[idx2 + 1 + cnt]))