Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace2: prevent segfault on config collection where no value specified #1814

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions t/t0210-trace2-normal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ test_expect_success 'bug messages followed by BUG() are written to trace2' '
test_cmp expect actual
'

test_expect_success 'empty configuration values are handled' '
test_when_finished "rm trace2.normal actual expect" &&
echo >expect &&
GIT_TRACE2="$(pwd)/trace2.normal" GIT_TRACE2_CONFIG_PARAMS=foo.empty \
git -c foo.empty config foo.empty >actual &&
test_cmp expect actual
'

sane_unset GIT_TRACE2_BRIEF

# Now test without environment variables and get all Trace2 settings
Expand Down
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)
if (!trace2_enabled || !value)
return;

redacted = redact_arg(value);
Expand Down
Loading