diff options
| author | Jacob Keller <jacob.keller@gmail.com> | 2025-02-21 15:47:58 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-21 18:27:16 -0800 |
| commit | bb60c5213134cda73c31940ec0fb33c361a064eb (patch) | |
| tree | ee904f2746cf68a692306a19b6f88966c325f0a1 | |
| parent | e1fbebe347426ef7974dc2198f8a277b7c31c8fe (diff) | |
| download | git-bb60c5213134cda73c31940ec0fb33c361a064eb.tar.gz | |
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 "bugs@company.xx"
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 <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | builtin/check-mailmap.c | 2 | ||||
| -rwxr-xr-x | t/t4203-mailmap.sh | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index df00b5ee13..be2cebe121 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -35,7 +35,7 @@ static void check_mailmap(struct string_list *mailmap, const char *contact) mail = ident.mail_begin; maillen = ident.mail_end - ident.mail_begin; } else { - name = NULL; + name = ""; namelen = 0; mail = contact; maillen = strlen(contact); diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 2265ff8872..0efa1ac86c 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -114,6 +114,18 @@ test_expect_success 'check-mailmap --stdin simple address: no mapping' ' test_cmp expect actual ' +test_expect_success 'check-mailmap name and address: mapping' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-EOF && + Bug Reports <bugs-new@company.xx> Bugs <bugs@company.xx> + EOF + cat >expect <<-EOF && + <bugs@company.xx> + EOF + git check-mailmap "bugs@company.xx" >actual && + test_cmp expect actual +' + test_expect_success 'No mailmap' ' cat >expect <<-EOF && $GIT_AUTHOR_NAME (1): |
