Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jk/ident-ai-canonname-could-be-null'
author
Junio C Hamano
<gitster@pobox.com>
Thu, 29 Sep 2016 23:57:14 +0000
(16:57 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 29 Sep 2016 23:57:14 +0000
(16:57 -0700)
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
ident.c
patch
|
blob
|
history
raw
(from parent 1:
938c2a6
)
diff --git
a/ident.c
b/ident.c
index 92c3cca510ab8bfb718e5a3cb07e5871d38ce055..ac4ae02b485637002869b3fc7a78033d7a5b6aec 100644
(file)
--- 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;
}