git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Ariel Badichi <abadichi@bezeqint.net>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] archive.c: format_subst - fixed bogus argument to memchr
Date: Wed, 23 Apr 2008 17:54:37 +0200	[thread overview]
Message-ID: <480F5BBD.8090101@lsrfire.ath.cx> (raw)
In-Reply-To: <87od81peog.fsf@sneeze.site>

Ariel Badichi schrieb:
> Also removed a superfluous test.
> 
> Signed-off-by: Ariel Badichi <abadichi@bezeqint.net>
> ---
>  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@lsrfire.ath.cx>

  parent reply	other threads:[~2008-04-23 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23  0:24 [PATCH] archive.c: format_subst - fixed bogus argument to memchr Ariel Badichi
2008-04-23  1:28 ` Ariel Badichi
2008-04-23 15:54 ` René Scharfe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-23  1:06 Ariel Badichi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480F5BBD.8090101@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=abadichi@bezeqint.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).