Re: [PATCH 15/13] compat/fnmatch: fix off-by-one character class's length check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 11/11/2012 11:13, schrieb Nguyễn Thái Ngọc Duy:
> Character class "xdigit" is the only one that hits 6 character limit
> defined by CHAR_CLASS_MAX_LENGTH. All other character classes are 5
> character long and therefore never caught by this.
> 
> This should make xdigit tests in t3070 pass on Windows.
> 
> Reported-by: Johannes Sixt <j6t@xxxxxxxx>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  I tested with Linux (removing the ifdef __LIBC in fnmatch.c) but I
>  think this should get an ACK from someone who actually uses it on
>  Windows.

Works well here on Windows.

This does not affect Windows alone, but all platforms that fall back to
compat/fnmatch. It's perhaps worth its own topic branch.

>  We may want to tell upstream (who?) about this if they haven't fixed
>  it already.
> 
>  compat/fnmatch/fnmatch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
> index 9473aed..0ff1d27 100644
> --- a/compat/fnmatch/fnmatch.c
> +++ b/compat/fnmatch/fnmatch.c
> @@ -345,7 +345,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
>  
>  		    for (;;)
>  		      {
> -			if (c1 == CHAR_CLASS_MAX_LENGTH)
> +			if (c1 > CHAR_CLASS_MAX_LENGTH)
>  			  /* The name is too long and therefore the pattern
>  			     is ill-formed.  */
>  			  return FNM_NOMATCH;
> 

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]