All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tommi Kyntola <tommi.kyntola@ray.fi>
To: git@vger.kernel.org
Subject: [PATCH] git-blame: prevent argument parsing segfault
Date: Fri, 16 Feb 2007 09:38:21 +0200	[thread overview]
Message-ID: <45D55F6D.5090900@ray.fi> (raw)


Description:
k@samael /localhome/k/git.git/git/gitweb % git-blame --incremental
zsh: segmentation fault  git blame --incremental

The 3rd branch in builtin-blame.c should also check for lacking
arguments. Running that in top dir avoids the problem because
the 'prefix' is NULL. The --incremental is no to blame here,
it only triggers the segfault and even without that flag it goes
checking argv too far.

I didn't check the pu branch, and I'm sorry if this is a dupe.

cheers,
Tommi "Kynde" Kyntola

diff --git a/builtin-blame.c b/builtin-blame.c
index 7a5665f..6d51b1f 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2211,6 +2211,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
                 }
                 else {
                         /* (3) */
+                       if (argc <= i)
+                               usage(blame_usage);
                         path = add_prefix(prefix, argv[i]);
                         if (i + 1 == argc - 1) {
                                 final_commit_name = argv[i + 1];

             reply	other threads:[~2007-02-16  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16  7:38 Tommi Kyntola [this message]
2007-02-16  8:23 ` [PATCH] git-blame: prevent argument parsing segfault Junio C Hamano

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=45D55F6D.5090900@ray.fi \
    --to=tommi.kyntola@ray.fi \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.