Skip to content

Commit 75b7dfb

Browse files
Ariel Badichigitster
authored andcommitted
archive.c: format_subst - fixed bogus argument to memchr
Also removed a superfluous test. Signed-off-by: Ariel Badichi <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8b1f6de commit 75b7dfb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

archive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ static void format_subst(const struct commit *commit,
1616
const char *b, *c;
1717

1818
b = memmem(src, len, "$Format:", 8);
19-
if (!b || src + len < b + 9)
19+
if (!b)
2020
break;
21-
c = memchr(b + 8, '$', len - 8);
21+
c = memchr(b + 8, '$', (src + len) - b - 8);
2222
if (!c)
2323
break;
2424

0 commit comments

Comments
 (0)