Re: [PATCH] Add known breakage for 'git notes copy'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]