(class__wildMatch) Fixed bug which overran pattern string, spotted by
[become] / src / class.c
index 49b1341..31d6de6 100644 (file)
@@ -1,10 +1,10 @@
 /* -*-c-*-
  *
- * $Id: class.c,v 1.6 1997/09/17 10:14:56 mdw Exp $
+ * $Id: class.c,v 1.8 1998/06/08 11:20:36 mdw Exp $
  *
  * Handling classes of things nicely
  *
- * (c) 1997 EBI
+ * (c) 1998 EBI
  */
 
 /*----- Licensing notice --------------------------------------------------*
 /*----- Revision history --------------------------------------------------*
  *
  * $Log: class.c,v $
- * Revision 1.6  1997/09/17 10:14:56  mdw
+ * 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.
+ *
+ * Revision 1.6  1997/09/17  10:14:56  mdw
  * Complete rewrite to support class trees.  Makes the behaviour of the set
  * operators much more logical.
  *
@@ -102,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