Code

git-blame: Fix overrun in fake_working_tree_commit()
authorMichael Spang <mspang@uwaterloo.ca>
Sat, 14 Apr 2007 21:26:20 +0000 (17:26 -0400)
committerJunio C Hamano <junkio@cox.net>
Sun, 15 Apr 2007 00:37:28 +0000 (17:37 -0700)
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>
builtin-blame.c

index 60ec5354f11c61c49829d41e8c07d22573f16bc7..bc86bda6c474a1e7ca0789b2c83e6201f370cb5f 100644 (file)
@@ -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"