]> granicus.if.org Git - sudo/commitdiff
Remove artificial limit on length of pattern and string. It is
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 10 Dec 2014 21:00:12 +0000 (14:00 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 10 Dec 2014 21:00:12 +0000 (14:00 -0700)
possible to use fnmatch() on things other than paths (such as
arguments) so a limit of PATH_MAX does not make sense.  Fixes a bug
where rules would fail to match if the length of the arguments were
larger than PATH_MAX (usually 1024).

lib/util/fnmatch.c

index eb4e756fde651a82d99d6a09fb97d1036c300eb6..8861937d48cbad0ecab4796bff5ed596a6ad7d22 100644 (file)
@@ -83,7 +83,6 @@
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif /* HAVE_STRINGS_H */
-#include <limits.h>
 
 #include "sudo_compat.h"
 #include "compat/charclass.h"
@@ -284,9 +283,6 @@ int sudo_fnmatch(const char *pattern, const char *string, int flags)
     const char *mismatch = NULL;
     int matchlen = 0;
 
-    if (strlen(pattern) > PATH_MAX || strlen(string) > PATH_MAX)
-       return FNM_NOMATCH;
-
     if (*pattern == '*')
         goto firstsegment;