5 Commits

Author SHA1 Message Date
Szabolcs Nagy
da0fcdb8e9 fix the end of string matching in fnmatch with FNM_PATHNAME
a '/' in the pattern could be incorrectly matched against the
terminating null byte in the string causing arbitrarily long
sequence of out-of-bounds access in fnmatch("/","",FNM_PATHNAME)
2013-12-01 17:32:48 +00:00
Rich Felker
45b38550ee new fnmatch implementation
unlike the old one, this one's algorithm does not suffer from
potential stack overflow issues or pathologically bad performance on
certain patterns. instead of backtracking, it uses a matching
algorithm which I have not seen before (unsure whether I invented or
re-invented it) that runs in O(1) space and O(nm) time. it may be
possible to improve the time to O(n), but not without significantly
greater complexity.
2012-04-28 18:05:29 -04:00
Rich Felker
2b87a5db82 update fnmatch to POSIX 2008 semantics
an invalid bracket expression must be treated as if the opening
bracket were just a literal character. this is to fix a bug whereby
POSIX left the behavior of the "[" shell command undefined due to it
being an invalid bracket expression.
2012-04-26 12:24:44 -04:00
Rich Felker
a6c399cf62 eliminate (harmless in this case) vla usage in fnmatch.c 2011-06-05 13:30:56 -04:00
Rich Felker
0b44a0315b initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00