X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=archive.c;h=7a32c19d3ca8043f3ca22dadfdbc60dbbb747d59;hb=2b2828b452bd8b3258de75451f77362decb1dffe;hp=fb159fe59e9e6fc40db584468c7b1ddf8495ccb3;hpb=f124e986cf19e8f36895ae474d50f8d389e73d02;p=git.git diff --git a/archive.c b/archive.c index fb159fe59..7a32c19d3 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;