Re: [BUG] git stash show -p with invalid option aborts with double-free in show_stash() (strvec_clear)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 19, 2025, 18:15 UTC
- Message-ID
- <xmqqbjn65mxa.fsf@gitster.g>
- In-Reply-To
- <20250919172007.GA59895@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> But really, I do not know that we need to NULL the whole thing. We have > given the caller the reduced argc. The only argv invariant we are > violating is that argv[argc] should be NULL (or in this case, > argv[left]). Anything after argv+left should be considered > uninitialized. So just: > > argv[left] = NULL; > > would be enough, I'd think.
Even when strvec was passed and more than one element was eaten after parsing? strvec_clear() goes by .nr not stopping at the first NULL IIRC.