diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-03-19 15:03:12 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-03-19 15:03:12 -0700 |
commit | fc1a4ce043e4b07d1551a24ec224bd43b9405ec8 (patch) | |
tree | 973c130cb04cf972d6b82b98f6f0ca6aaa850eda /sequencer.c | |
parent | 0717a424a723201c4b77da3638764c70819c3f63 (diff) | |
parent | 15a4cc912e601c1641e549861e284f63e30f562c (diff) | |
download | git-fc1a4ce043e4b07d1551a24ec224bd43b9405ec8.tar.gz |
Merge branch 'ab/fix-strategy-opts-parsing'
The code to parse "git rebase -X<opt>" was not prepared to see an
unparsable option string, which has been corrected.
* ab/fix-strategy-opts-parsing:
sequencer.c: fix overflow & segfault in parse_strategy_opts()
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c index fb99115be5..3be23d7ca2 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2919,13 +2919,18 @@ static int populate_opts_cb(const char *key, const char *value, void *data) void parse_strategy_opts(struct replay_opts *opts, char *raw_opts) { int i; + int count; char *strategy_opts_string = raw_opts; if (*strategy_opts_string == ' ') strategy_opts_string++; - opts->xopts_nr = split_cmdline(strategy_opts_string, - (const char ***)&opts->xopts); + count = split_cmdline(strategy_opts_string, + (const char ***)&opts->xopts); + if (count < 0) + die(_("could not split '%s': %s"), strategy_opts_string, + split_cmdline_strerror(count)); + opts->xopts_nr = count; for (i = 0; i < opts->xopts_nr; i++) { const char *arg = opts->xopts[i]; |