(class__wildMatch) Fixed bug which overran pattern string, spotted by
authormdw <mdw>
Mon, 8 Jun 1998 11:20:36 +0000 (11:20 +0000)
committermdw <mdw>
Mon, 8 Jun 1998 11:20:36 +0000 (11:20 +0000)
Mark Rison.

src/class.c

index 581e93b..31d6de6 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: class.c,v 1.7 1998/01/12 16:45:50 mdw Exp $
+ * $Id: class.c,v 1.8 1998/06/08 11:20:36 mdw Exp $
  *
  * Handling classes of things nicely
  *
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: class.c,v $
+ * Revision 1.8  1998/06/08 11:20:36  mdw
+ * (class__wildMatch) Fixed bug which overran pattern string, spotted by
+ * Mark Rison.
+ *
  * Revision 1.7  1998/01/12 16:45:50  mdw
  * Fix copyright date.
  *
@@ -105,12 +109,14 @@ static int class__wildMatch(const char *pat, const char *p)
     else if (*pat == '*') {
       while (*pat == '*')
        pat++;
+      if (!*pat)
+       return (58);
       do {
        if (class__wildMatch(pat, p))
          return (27); /* Nyahaha */
        p++;
       } while (*p);
-      return (pat[1] == 0);
+      return (0);
     } else if (*pat == '?' || *pat == *p)
       p++, pat++;
     else