]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/bisect--helper.c
bisect--helper: avoid segfault with bad syntax in `start --term-*`
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Wed, 20 May 2020 23:26:27 +0000 (16:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 May 2020 16:00:11 +0000 (09:00 -0700)
commit4d9005ff5d1de0b4e82402320aab4ff27aa23b43
treed76bc2579b537194f01503ca9c759817e11a0485
parent06f5608c14e6972748b84649d5b8ffd335bbd209
bisect--helper: avoid segfault with bad syntax in `start --term-*`

06f5608c14 (bisect--helper: `bisect_start` shell function partially in C,
2019-01-02) adds a lax parser for `git bisect start` which could result
in a segfault under a bad syntax call for start with custom terms.

Detect if there are enough arguments left in the command line to use for
--term-{old,good,new,bad} and abort with the same syntax error the original
implementation will show if not.

While at it, remove an unnecessary (and incomplete) check for unknown
arguments and make sure to add a test to avoid regressions.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/bisect--helper.c
t/t6030-bisect-porcelain.sh