[PATCH 3/4] load_revindex_from_disk(): avoid accessing uninitialized data
From: Johannes Schindelin via GitGitGadget <hidden>
Date: 2025-03-27 12:43:55
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Johannes Schindelin via GitGitGadget <hidden>
Date: 2025-03-27 12:43:55
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Johannes Schindelin <redacted> The `revindex_size` value is uninitialized in case the function is erroring out, but we want to assign its value. Let's just initialize it. Signed-off-by: Johannes Schindelin <redacted> --- pack-revindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pack-revindex.c b/pack-revindex.c
index d3832478d99..3b007d771b3 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c@@ -208,7 +208,7 @@ static int load_revindex_from_disk(char *revindex_name, int fd, ret = 0; struct stat st; void *data = NULL; - size_t revindex_size; + size_t revindex_size = 0; struct revindex_header *hdr; if (git_env_bool(GIT_TEST_REV_INDEX_DIE_ON_DISK, 0))
--
gitgitgadget