Skip to content

Commit bb60c52

Browse files
jacob-kellergitster
authored andcommitted
mailmap: fix check-mailmap with full mailmap line
I recently had reported to me a crash from a coworker using the recently added sendemail mailmap support: 3724814 Segmentation fault (core dumped) git check-mailmap "[email protected]" This appears to happen because of the NULL pointer name passed into map_user(). Fix this by passing "" instead of NULL so that we have a valid pointer. Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e1fbebe commit bb60c52

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

builtin/check-mailmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static void check_mailmap(struct string_list *mailmap, const char *contact)
3535
mail = ident.mail_begin;
3636
maillen = ident.mail_end - ident.mail_begin;
3737
} else {
38-
name = NULL;
38+
name = "";
3939
namelen = 0;
4040
mail = contact;
4141
maillen = strlen(contact);

t/t4203-mailmap.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ test_expect_success 'check-mailmap --stdin simple address: no mapping' '
114114
test_cmp expect actual
115115
'
116116

117+
test_expect_success 'check-mailmap name and address: mapping' '
118+
test_when_finished "rm .mailmap" &&
119+
cat >.mailmap <<-EOF &&
120+
121+
EOF
122+
cat >expect <<-EOF &&
123+
124+
EOF
125+
git check-mailmap "[email protected]" >actual &&
126+
test_cmp expect actual
127+
'
128+
117129
test_expect_success 'No mailmap' '
118130
cat >expect <<-EOF &&
119131
$GIT_AUTHOR_NAME (1):

0 commit comments

Comments
 (0)