Skip to content

Commit

Permalink
When TRACE2 analytics is enabled, a git config option that has no value
Browse files Browse the repository at this point in the history
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

This adds checks to prevent the segfault and instead return
an empty value.

Signed-off-by: Adam Murray <[email protected]>
  • Loading branch information
ad-murray committed Jan 7, 2025
1 parent 627d9b5 commit e48f724
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trace2.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ void trace2_def_param_fl(const char *file, int line, const char *param,
int j;
const char *redacted;

if (!trace2_enabled || !value)
if (!trace2_enabled)
return;

redacted = value ? redact_arg(value): NULL;
Expand Down

0 comments on commit e48f724

Please sign in to comment.