Re: [PATCH 2/6] dir.c::match_basename(): pay attention to the length of string parameters
On Fri, Mar 29, 2013 at 4:47 AM, Jeff King <peff@peff.net> wrote:
Show 20 quoted lines
> +static int fnmatch_icase_mem(const char *pattern, int patternlen,
> + const char *string, int stringlen,
> + int flags)
> +{
> + int match_status;
> + struct strbuf pat_buf = STRBUF_INIT;
> + struct strbuf str_buf = STRBUF_INIT;
> + const char *use_pat = pattern;
> + const char *use_str = string;
> +
> + if (pattern[patternlen]) {
> + strbuf_add(&pat_buf, pattern, patternlen);
> + use_pat = pat_buf.buf;
> + }
> + if (string[stringlen]) {
> + strbuf_add(&str_buf, string, stringlen);
> + use_str = str_buf.buf;
> + }
> +
> + match_status = fnmatch_icase(use_pat, use_str, 0);You should pass flags in here instead of 0.
--
Duy