git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Spang <mspang@uwaterloo.ca>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: [PATCH] git-blame: Fix overrun in fake_working_tree_commit()
Date: Sat, 14 Apr 2007 17:26:20 -0400	[thread overview]
Message-ID: <462146FC.9060202@uwaterloo.ca> (raw)

git-blame would overflow commit->buffer when annotating files with long paths.

Signed-off-by: Michael Spang <mspang@uwaterloo.ca>
---
 builtin-blame.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-blame.c b/builtin-blame.c
index 60ec535..bc86bda 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"

                 reply	other threads:[~2007-04-14 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=462146FC.9060202@uwaterloo.ca \
    --to=mspang@uwaterloo.ca \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).