Re: [PATCH] archive.c: format_subst - fixed bogus argument to memchr

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

 



Ariel Badichi schrieb:
> Also removed a superfluous test.
> 
> Signed-off-by: Ariel Badichi <abadichi@xxxxxxxxxxxx>
> ---
>  archive.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/archive.c b/archive.c
> index fb159fe..7a32c19 100644
> --- a/archive.c
> +++ b/archive.c
> @@ -16,9 +16,9 @@ static void format_subst(const struct commit *commit,
>  		const char *b, *c;
>  
>  		b = memmem(src, len, "$Format:", 8);
> -		if (!b || src + len < b + 9)
> +		if (!b)
>  			break;

OK.

> -		c = memchr(b + 8, '$', len - 8);
> +		c = memchr(b + 8, '$', (src + len) - b - 8);
>  		if (!c)
>  			break;

Ouch.  Perhaps rearranging it to "len - (b - src) - 8" would make it a
little easier to read?  Anyway, thanks and:

Acked-by: Rene Scharfe <rene.scharfe@xxxxxxxxxxxxxx>

--
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]

  Powered by Linux