fnmatch: don't goto over declaration
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 Jul 2013 00:12:29 +0000 (17:12 -0700)
committerIan Beckwith <ianb@erislabs.net>
Mon, 5 Aug 2013 02:17:04 +0000 (03:17 +0100)
* lib/fnmatch_loop.c (FCT): Hoist local up one level, to avoid
undefined behavior for goto over a declaration.
Problem reported by Charlie Brown in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-07/msg00009.html>.
(cherry picked from commit c96bab3fee48a9df55e7366344f838e1fc785c28)

ChangeLog
lib/fnmatch_loop.c

index 6235a46..21eedcd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       fnmatch: don't goto over declaration
+       * lib/fnmatch_loop.c (FCT): Hoist local up one level, to avoid
+       undefined behavior for goto over a declaration.
+       Problem reported by Charlie Brown in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-07/msg00009.html>.
+
 2013-07-03  Eric Blake  <eblake@redhat.com>
 
        mgetgroups: relax license to LGPLv2+
index 1953302..c303de2 100644 (file)
@@ -227,6 +227,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
             c = *p++;
             for (;;)
               {
+               bool is_range = false;
+
                 if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
                   {
                     if (*p == L_('\0'))
@@ -420,8 +422,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
                   }
                 else
                   {
-                    bool is_range = false;
-
 #ifdef _LIBC
                     bool is_seqval = false;