Re: [PATCH] builtin/gc.c: fix use-after-free in maintenance_unregister()
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 16, 2022, 15:14 UTC
- Message-ID
- <221116.865yffj5ha.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <2ce55cf7-5eef-8e6d-7b91-9a4bc16ed1c4@github.com>
On Wed, Nov 16 2022, Derrick Stolee wrote:
Show 19 quoted lines
> On 11/15/22 2:54 PM, Taylor Blau wrote:
>> On Tue, Nov 15, 2022 at 08:41:44PM +0100, Ævar Arnfjörð Bjarmason wrote:
>>>> @@ -1543,6 +1543,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
>>>> int found = 0;
>>>> struct string_list_item *item;
>>>> const struct string_list *list;
>>>> + struct config_set cs = { { 0 } };
>>>
>>> Just "{ 0 }" here instead? I see it may have been copied from some older
>>> pre-image though, and they'll do the same in either case, so it's not
>>> important...
>>
>> Copying from other zero-initializations of `struct config_set`:
>>
>> $ git grep -oh 'struct config_set.*= {.*' | sort | uniq -c
>> 3 struct config_set cs = { { 0 } };
>
> Yes, without the double braces the compiler will complain on
> macOS, I believe.Ah, that was sorted in 54795d37d9e (config.mak.dev: disable suggest braces error on old clang versions, 2022-10-10).
It's fine here, we can follow-up for the #leftoverbits of changing those some other time.