From: Michael Spang Date: Sat, 14 Apr 2007 21:26:20 +0000 (-0400) Subject: git-blame: Fix overrun in fake_working_tree_commit() X-Git-Tag: v1.5.1.2~33 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=1bb88be99e4fdedcd5cc5292c11b566a00028deb;p=git.git git-blame: Fix overrun in fake_working_tree_commit() git-blame would overflow commit->buffer when annotating files with long paths. Signed-off-by: Michael Spang Signed-off-by: Junio C Hamano --- diff --git a/builtin-blame.c b/builtin-blame.c index 60ec5354f..bc86bda6c 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -2041,7 +2041,7 @@ static struct commit *fake_working_tree_commit(const char *path, const char *con commit->buffer = xmalloc(400); ident = fmt_ident("Not Committed Yet", "not.committed.yet", NULL, 0); - sprintf(commit->buffer, + snprintf(commit->buffer, 400, "tree 0000000000000000000000000000000000000000\n" "parent %s\n" "author %s\n"