diff options
author | Jeff King <peff@peff.net> | 2013-03-28 17:48:21 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-28 21:48:18 -0700 |
commit | ab3aebc15c13d083013591777688cecbcb703fb2 (patch) | |
tree | e3dff778e8b98dcc96649398713aac809bf04b0d /t/t5515/refs.br-unconfig_remote-explicit | |
parent | dir.c::match_pathname(): adjust patternlen when shifting pattern (diff) | |
download | tgif-ab3aebc15c13d083013591777688cecbcb703fb2.tar.xz |
dir.c::match_pathname(): pay attention to the length of string parameters
This function takes two counted strings: a <pattern, patternlen> pair
and a <pathname, pathlen> pair. But we end up feeding the result to
fnmatch, which expects NUL-terminated strings.
We can fix this by calling the fnmatch_icase_mem function, which
handles re-allocating into a NUL-terminated string if necessary.
While we're at it, we can avoid even calling fnmatch in some cases. In
addition to patternlen, we get "prefix", the size of the pattern that
contains no wildcard characters. We do a straight match of the prefix
part first, and then use fnmatch to cover the rest. But if there are
no wildcards in the pattern at all, we do not even need to call
fnmatch; we would simply be comparing two empty strings.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5515/refs.br-unconfig_remote-explicit')
0 files changed, 0 insertions, 0 deletions