* [PATCH] archive.c: format_subst - fixed bogus argument to memchr
@ 2008-04-23 0:24 Ariel Badichi
2008-04-23 1:28 ` Ariel Badichi
2008-04-23 15:54 ` René Scharfe
0 siblings, 2 replies; 4+ messages in thread
From: Ariel Badichi @ 2008-04-23 0:24 UTC (permalink / raw)
To: git; +Cc: gitster
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;
- c = memchr(b + 8, '$', len - 8);
+ c = memchr(b + 8, '$', (src + len) - b - 8);
if (!c)
break;
--
1.5.5.1.57.g5909c
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] archive.c: format_subst - fixed bogus argument to memchr
@ 2008-04-23 1:06 Ariel Badichi
0 siblings, 0 replies; 4+ messages in thread
From: Ariel Badichi @ 2008-04-23 1:06 UTC (permalink / raw)
To: git; +Cc: gitster
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;
- c = memchr(b + 8, '$', len - 8);
+ c = memchr(b + 8, '$', (src + len) - b - 8);
if (!c)
break;
--
1.5.5.1.57.g5909c
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] archive.c: format_subst - fixed bogus argument to memchr
2008-04-23 0:24 Ariel Badichi
@ 2008-04-23 1:28 ` Ariel Badichi
2008-04-23 15:54 ` René Scharfe
1 sibling, 0 replies; 4+ messages in thread
From: Ariel Badichi @ 2008-04-23 1:28 UTC (permalink / raw)
To: git
Ariel Badichi <abadichi@bezeqint.net> writes:
Arf. Sorry about the duplicates.
Ariel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] archive.c: format_subst - fixed bogus argument to memchr
2008-04-23 0:24 Ariel Badichi
2008-04-23 1:28 ` Ariel Badichi
@ 2008-04-23 15:54 ` René Scharfe
1 sibling, 0 replies; 4+ messages in thread
From: René Scharfe @ 2008-04-23 15:54 UTC (permalink / raw)
To: Ariel Badichi; +Cc: git, gitster
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-23 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 1:06 [PATCH] archive.c: format_subst - fixed bogus argument to memchr Ariel Badichi
-- strict thread matches above, loose matches on Subject: below --
2008-04-23 0:24 Ariel Badichi
2008-04-23 1:28 ` Ariel Badichi
2008-04-23 15:54 ` René Scharfe
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).