diff options
author | René Scharfe <l.s.r@web.de> | 2021-02-28 12:22:47 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-11 22:22:44 +0100 |
commit | 96099726ddb00b45135964220ce56468ba9fe184 (patch) | |
tree | 67511a24e20bf148d232a8595719cb8bf48d4077 /pretty.c | |
parent | pretty: document multiple %(describe) being inconsistent (diff) | |
download | git-96099726ddb00b45135964220ce56468ba9fe184.tar.xz git-96099726ddb00b45135964220ce56468ba9fe184.zip |
archive: expand only a single %(describe) per archive
Every %(describe) placeholder in $Format:...$ strings in files with the
attribute export-subst is expanded by calling git describe. This can
potentially result in a lot of such calls per archive. That's OK for
local repositories under control of the user of git archive, but could
be a problem for hosted repositories.
Expand only a single %(describe) placeholder per archive for now to
avoid denial-of-service attacks. We can make this limit configurable
later if needed, but let's start out simple.
Reported-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1247,6 +1247,14 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ struct child_process cmd = CHILD_PROCESS_INIT; struct strbuf out = STRBUF_INIT; struct strbuf err = STRBUF_INIT; + struct pretty_print_describe_status *describe_status; + + describe_status = c->pretty_ctx->describe_status; + if (describe_status) { + if (!describe_status->max_invocations) + return 0; + describe_status->max_invocations--; + } cmd.git_cmd = 1; strvec_push(&cmd.args, "describe"); |