From: Stefan Beller <stefanbeller@googlemail.com>
To: hiroshige88@gmail.com, gitster@pobox.com, jrnieder@gmail.com,
git@vger.kernel.org
Cc: Stefan Beller <stefanbeller@googlemail.com>
Subject: [PATCH] cherry-pick: do not segfault without arguments.
Date: Fri, 4 Oct 2013 16:09:12 +0200 [thread overview]
Message-ID: <1380895752-5286-1-git-send-email-stefanbeller@googlemail.com> (raw)
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@googlemail.com>
---
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
next reply other threads:[~2013-10-04 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-04 14:09 Stefan Beller [this message]
2013-10-10 16:41 ` [PATCH] cherry-pick: do not segfault without arguments Jeff King
2013-10-10 21:17 ` Stefan Beller
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=1380895752-5286-1-git-send-email-stefanbeller@googlemail.com \
--to=stefanbeller@googlemail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hiroshige88@gmail.com \
--cc=jrnieder@gmail.com \
/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).