author | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 04:44:17 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 05:28:48 +0000 |
commit | 1507ebf837334e9e07cfab1ca1c2e88449069a80 (patch) | |
tree | 92bad1f861e442f7e2d2fa4e178f471f4371509a /src/regex | |
parent | 38e2f727237230300fea6aff68802db04625fd23 (diff) | |
download | musl-1507ebf837334e9e07cfab1ca1c2e88449069a80.tar.gz |
-rw-r--r-- | src/regex/fnmatch.c | 3 |
diff --git a/src/regex/fnmatch.c b/src/regex/fnmatch.c index 7f6b65f3..978fff88 100644 --- a/src/regex/fnmatch.c +++ b/src/regex/fnmatch.c @@ -18,6 +18,7 @@ #include <stdlib.h> #include <wchar.h> #include <wctype.h> +#include "locale_impl.h" #define END 0 #define UNMATCHABLE -2 @@ -229,7 +230,7 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n * On illegal sequences we may get it wrong, but in that case * we necessarily have a matching failure anyway. */ for (s=endstr; s>str && tailcnt; tailcnt--) { - if (s[-1] < 128U) s--; + if (s[-1] < 128U || MB_CUR_MAX==1) s--; else while ((unsigned char)*--s-0x80U<0x40 && s>str); } if (tailcnt) return FNM_NOMATCH; |