[PATCH] cherry-pick: do not segfault without arguments.

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

 



Commit 182d7dc46b (2013-09-05, cherry-pick: allow "-" as abbreviation of
'@{-1}') accesses the first argument without checking whether it exists.

Signed-off-by: Stefan Beller <stefanbeller@xxxxxxxxxxxxxx>
---
 builtin/revert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/revert.c b/builtin/revert.c
index 52c35e7..f81a48c 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -202,7 +202,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
 	memset(&opts, 0, sizeof(opts));
 	opts.action = REPLAY_PICK;
 	git_config(git_default_config, NULL);
-	if (!strcmp(argv[1], "-"))
+	if (argc > 1 && !strcmp(argv[1], "-"))
 		argv[1] = "@{-1}";
 	parse_args(argc, argv, &opts);
 	res = sequencer_pick_revisions(&opts);
-- 
1.8.4.1.469.gb38b9db

--
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]