From 2fd367cf63cd5f94368340cc6fe1cd0a3fb021df Mon Sep 17 00:00:00 2001 From: Adam Murray Date: Fri, 10 Jan 2025 07:28:20 +0000 Subject: trace2: prevent segfault on config collection with valueless true When TRACE2 analytics is enabled, a configuration variable set to "valueless true" causes a segfault. Steps to Reproduce GIT_TRACE2=true GIT_TRACE2_CONFIG_PARAMS=status.* git -c status.relativePaths version Expected Result git version 2.46.0 Actual Result zsh: segmentation fault GIT_TRACE2=true Add checks to prevent the segfault and instead show that the variable without value. Signed-off-by: Adam Murray Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- trace2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'trace2.c') diff --git a/trace2.c b/trace2.c index f894532d05..e67edf4b1b 100644 --- a/trace2.c +++ b/trace2.c @@ -762,7 +762,7 @@ void trace2_def_param_fl(const char *file, int line, const char *param, if (!trace2_enabled) return; - redacted = redact_arg(value); + redacted = value ? redact_arg(value) : NULL; for_each_wanted_builtin (j, tgt_j) if (tgt_j->pfn_param_fl) -- cgit v1.2.3