Skip to content

Commit 11738dd

Browse files
committed
Merge branch 'jk/ident-ai-canonname-could-be-null' into maint
In the codepath that comes up with the hostname to be used in an e-mail when the user didn't tell us, we looked at ai_canonname field in struct addrinfo without making sure it is not NULL first. * jk/ident-ai-canonname-could-be-null: ident: handle NULL ai_canonname
2 parents 3d0049e + c375a7e commit 11738dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ident.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)
101101
memset (&hints, '\0', sizeof (hints));
102102
hints.ai_flags = AI_CANONNAME;
103103
if (!getaddrinfo(host, NULL, &hints, &ai)) {
104-
if (ai && strchr(ai->ai_canonname, '.')) {
104+
if (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {
105105
strbuf_addstr(out, ai->ai_canonname);
106106
status = 0;
107107
}

0 commit comments

Comments
 (0)