Commit 776f184
config.c: NULL check when reading protected config
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 <[email protected]>
Signed-off-by: Glen Choo <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 8d1a744 commit 776f184
1 file changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1979 | 1979 | | |
1980 | 1980 | | |
1981 | 1981 | | |
| 1982 | + | |
| 1983 | + | |
1982 | 1984 | | |
1983 | 1985 | | |
1984 | 1986 | | |
| |||
2645 | 2647 | | |
2646 | 2648 | | |
2647 | 2649 | | |
2648 | | - | |
2649 | | - | |
2650 | | - | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
2651 | 2656 | | |
2652 | 2657 | | |
2653 | 2658 | | |
| |||
0 commit comments