git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Johan Herland <johan@herland.net>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add known breakage for 'git notes copy'
Date: Mon, 28 Jun 2010 04:59:07 -0400	[thread overview]
Message-ID: <20100628085907.GA14014@coredump.intra.peff.net> (raw)
In-Reply-To: <41768aafce7a581e8b601e70826ce77381458a23.1277708369.git.bert.wesarg@googlemail.com>

On Mon, Jun 28, 2010 at 09:01:57AM +0200, Bert Wesarg wrote:

> 'git notes copy' dumps core when no arguments are given.

How about:

-- >8 --
Subject: [PATCH] notes: check number of parameters to "git notes copy"

Otherwise we may segfault with too few parameters.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/notes.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin/notes.c b/builtin/notes.c
index f1f53a8..190005f 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -613,8 +613,12 @@ static int copy(int argc, const char **argv, const char *prefix)
 			return notes_copy_from_stdin(force, rewrite_cmd);
 		}
 	}
 
+	if (argc < 2) {
+		error("too few parameters");
+		usage_with_options(git_notes_copy_usage, options);
+	}
 	if (2 < argc) {
 		error("too many parameters");
 		usage_with_options(git_notes_copy_usage, options);
 	}
-- 
1.7.1.777.gd07fd

  reply	other threads:[~2010-06-28  8:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28  7:01 [PATCH] Add known breakage for 'git notes copy' Bert Wesarg
2010-06-28  8:59 ` Jeff King [this message]
2010-06-28  9:12   ` Bert Wesarg
2010-06-28 15:44     ` Jacob Helwig
2010-06-28 22:48     ` Johan Herland

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=20100628085907.GA14014@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johan@herland.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).