Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

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

From: Jeff King <hidden>
Date: 2016-06-15 22:49:01
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help