aboutsummaryrefslogtreecommitdiffstats
path: root/trailer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-12-20 10:14:54 -0800
committerJunio C Hamano <gitster@pobox.com>2023-12-20 10:14:54 -0800
commit2b9cbc6d01ba3e54de09efde1dd2ed46c2d36e94 (patch)
tree6ccb23924e2b2d806b3d67cf3796d3d7ad4695a2 /trailer.c
parent67dfb897b3ea438a5a7bb29af2cd0360235e5191 (diff)
parentd49cb162fa752d62cf20548ae057471d348e42ae (diff)
downloadgit-2b9cbc6d01ba3e54de09efde1dd2ed46c2d36e94.tar.gz
Merge branch 'jk/implicit-true'
Some codepaths did not correctly parse configuration variables specified with valueless "true", which has been corrected. * jk/implicit-true: fsck: handle NULL value when parsing message config trailer: handle NULL value when parsing trailer-specific config submodule: handle NULL value when parsing submodule.*.branch help: handle NULL value for alias.* config trace2: handle NULL values in tr2_sysenv config callback setup: handle NULL value when parsing extensions config: handle NULL value when parsing non-bools
Diffstat (limited to 'trailer.c')
-rw-r--r--trailer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/trailer.c b/trailer.c
index b6de5d9cb2..e4b08ed267 100644
--- a/trailer.c
+++ b/trailer.c
@@ -507,6 +507,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value,
warning(_("unknown value '%s' for key '%s'"),
value, conf_key);
} else if (!strcmp(trailer_item, "separators")) {
+ if (!value)
+ return config_error_nonbool(conf_key);
separators = xstrdup(value);
}
}
@@ -551,16 +553,22 @@ static int git_trailer_config(const char *conf_key, const char *value,
case TRAILER_KEY:
if (conf->key)
warning(_("more than one %s"), conf_key);
+ if (!value)
+ return config_error_nonbool(conf_key);
conf->key = xstrdup(value);
break;
case TRAILER_COMMAND:
if (conf->command)
warning(_("more than one %s"), conf_key);
+ if (!value)
+ return config_error_nonbool(conf_key);
conf->command = xstrdup(value);
break;
case TRAILER_CMD:
if (conf->cmd)
warning(_("more than one %s"), conf_key);
+ if (!value)
+ return config_error_nonbool(conf_key);
conf->cmd = xstrdup(value);
break;
case TRAILER_WHERE: