[PATCH 06/11] pack-redundant: avoid using uninitialized memory
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jun 15, 2022, 23:35 UTC
- Message-ID
- <bc29a9710e3a22e6d660098c4f201f3bfecc54ea.1655336146.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1264.git.1655336146.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
In the `add_pack()` function, we forgot to initialize the field `next`, which could potentially lead to readin uninitialized memory later.
Reported by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- builtin/pack-redundant.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index ed9b9013a5f..1f7da1f68b6 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -526,6 +526,7 @@ static struct pack_list * add_pack(struct packed_git *p) } l.all_objects_size = l.remaining_objects->size; l.unique_objects = NULL; + l.next = NULL; if (p->pack_local) return pack_list_insert(&local_packs, &l); else
-- gitgitgadget