[PATCH v2 06/15] remote: handle NULL value for remote.<name>.tagOpt
- From
Thomas Bachem via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Nov 10, 2026, 07:36 UTC
- Message-ID
- <d4b49d1363b8ba7f67c19f827d023915165d60a9.1794296205.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2297.v2.git.1794296205.gitgitgadget@gmail.com>
From: Thomas Bachem <mail@thomasbachem.com>
A remote.<name>.tagOpt without a value makes "git fetch", "git remote" and "git status" segfault: handle_config() passes the NULL value to strcmp().
Reject a missing value with config_error_nonbool(), as handle_config() already does for remote.<name>.url and remote.<name>.pushurl.
Assisted-by: Claude Fable 5.1 Signed-off-by: Thomas Bachem <mail@thomasbachem.com> --- remote.c | 2 ++ t/t5505-remote.sh | 5 +++++ 2 files changed, 7 insertions(+)
diff --git a/remote.c b/remote.c index 49ee2ea318..0db29d6dda 100644 --- a/remote.c +++ b/remote.c @@ -556,6 +556,8 @@ static int handle_config(const char *key, const char *value, else error(_("more than one uploadpack given, using the first")); } else if (!strcmp(subkey, "tagopt")) { + if (!value) + return config_error_nonbool(key); if (!strcmp(value, "--no-tags")) remote->fetch_tags = -1; else if (!strcmp(value, "--tags")) diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 5fbfcb0848..bec2e51afa 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -90,6 +90,11 @@ test_expect_success 'remote information for the origin' ' ) ' +test_expect_success 'tagOpt needs a value' ' + test_must_fail git -C test -c remote.origin.tagOpt remote 2>err && + test_grep "missing value for .remote.origin.tagopt." err +' + test_expect_success 'add another remote' ' ( cd test &&
-- gitgitgadget