summaryrefslogtreecommitdiffstats
path: root/ident.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-03 22:22:32 +0200
committerJunio C Hamano <gitster@pobox.com>2016-10-03 22:22:32 +0200
commit11738ddf4885c5bd02bdd3587c8765df70c3270e (patch)
treea14711effe7a9f73d02c17e331c95b387240bf9b /ident.c
parentMerge branch 'jk/doc-cvs-update' into maint (diff)
parentident: handle NULL ai_canonname (diff)
downloadgit-11738ddf4885c5bd02bdd3587c8765df70c3270e.tar.xz
git-11738ddf4885c5bd02bdd3587c8765df70c3270e.zip
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
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ident.c b/ident.c
index e20a772dde..d17b5bd341 100644
--- a/ident.c
+++ b/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;
}