Skip to content

pr-git-1299/chooglen/config/fix-sanitize-address-v2

From: Glen Choo <chooglen@google.com>

In read_protected_config(), check whether each file name is NULL before
attempting to read it, and add a BUG() call to
git_config_from_file_with_options() to make this error easier to catch
in the future.

The NULL checks mirror what do_git_config_sequence() does (which
read_protected_config() is modeled after). Without these NULL checks,
multiple tests fail with "make SANITIZE=address", e.g. in the final test
of t4010, xdg_config is NULL causing us to call fopen(NULL).

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Glen Choo <chooglen@google.com>

Submitted-As: https://lore.kernel.org/git/pull.1299.v2.git.git.1658874067077.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1299.git.git.1658855372189.gitgitgadget@gmail.com
Assets 2