aboutsummaryrefslogtreecommitdiff
path: root/contrib/tcp_wrappers
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2000-09-23 15:40:12 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2000-09-23 15:40:12 +0000
commit2f0cc2fd05699844ca9422b31b954d2b7f3bea8e (patch)
tree5cb1a90c6e03c7bcf241cefaa52954c6e08a4cce /contrib/tcp_wrappers
parent92b123a0025f64077d2efd31c48bb424bfac3c14 (diff)
downloadsrc-2f0cc2fd05699844ca9422b31b954d2b7f3bea8e.tar.gz
src-2f0cc2fd05699844ca9422b31b954d2b7f3bea8e.zip
Don't touch ai_canonname without checking NULL. Current
implementation of getaddrinfo() may return NULL ai_canonname. There is no consensus how getaddrinfo() should fill ai_canonname when numeric hostname is given. Reported by: kris
Notes
Notes: svn path=/head/; revision=66297
Diffstat (limited to 'contrib/tcp_wrappers')
-rw-r--r--contrib/tcp_wrappers/socket.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/tcp_wrappers/socket.c b/contrib/tcp_wrappers/socket.c
index 0a24aca40475..3fa1f5b8ddbe 100644
--- a/contrib/tcp_wrappers/socket.c
+++ b/contrib/tcp_wrappers/socket.c
@@ -245,7 +245,8 @@ struct host_info *host;
host->name,
(sin->sa_family == AF_INET) ? "AF_INET" : "AF_INET6");
- } else if (STR_NE(host->name, res0->ai_canonname)
+ } else if ((res0->ai_canonname == NULL
+ || STR_NE(host->name, res0->ai_canonname))
&& STR_NE(host->name, "localhost")) {
/*
@@ -255,7 +256,8 @@ struct host_info *host;
*/
tcpd_warn("host name/name mismatch: %s != %.*s",
- host->name, STRING_LENGTH, res0->ai_canonname);
+ host->name, STRING_LENGTH,
+ (res0->ai_canonname == NULL) ? "" : res0->ai_canonname);
} else {
@@ -294,7 +296,8 @@ struct host_info *host;
getnameinfo(sin, salen, hname, sizeof(hname),
NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID);
tcpd_warn("host name/address mismatch: %s != %.*s",
- hname, STRING_LENGTH, res0->ai_canonname);
+ hname, STRING_LENGTH,
+ (res0->ai_canonname == NULL) ? "" : res0->ai_canonname);
}
strcpy(host->name, paranoid); /* name is bad, clobber it */
if (res0)