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 <mspang@uwaterloo.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>
Michael Spang committed
Apr 14, 2007 at 17:26 UTC
1bb88be99e4fdedcd5cc5292c11b566a00028deb
1 file changed
+1
-1
builtin-blame.c
+1
-1
@@ -2041,7 +2041,7 @@ static struct commit *fake_working_tree_commit(const char *path, const char *con
2041
2042
commit->buffer = xmalloc(400);
2043
ident = fmt_ident("Not Committed Yet", "not.committed.yet", NULL, 0);
2044
- sprintf(commit->buffer,
2044
+ snprintf(commit->buffer, 400,
2045
"tree 0000000000000000000000000000000000000000\n"
2046
"parent %s\n"
2047
"author %s\n"