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>
Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2010-06-28 04:59:07 -04:00
committed by Junio C Hamano
parent 9eafa1201b
commit bbb1b8a35a
2 changed files with 10 additions and 0 deletions

View File

@ -614,6 +614,10 @@ static int copy(int argc, const char **argv, const char *prefix)
}
}
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);