mirror of
https://github.com/git/git.git
synced 2024-10-28 12:59:41 +01:00
Merge branch 'jk/ident-ai-canonname-could-be-null'
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
This commit is contained in:
commit
fff948fe0e
1 changed files with 1 additions and 1 deletions
2
ident.c
2
ident.c
|
@ -101,7 +101,7 @@ static int canonical_name(const char *host, struct strbuf *out)
|
|||
memset (&hints, '\0', sizeof (hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
if (!getaddrinfo(host, NULL, &hints, &ai)) {
|
||||
if (ai && strchr(ai->ai_canonname, '.')) {
|
||||
if (ai && ai->ai_canonname && strchr(ai->ai_canonname, '.')) {
|
||||
strbuf_addstr(out, ai->ai_canonname);
|
||||
status = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue