summaryrefslogtreecommitdiffstats
path: root/contrib/tcp_wrappers
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2000-09-23 15:40:12 +0000
committerume <ume@FreeBSD.org>2000-09-23 15:40:12 +0000
commit7478417f78b0803432f1cc1834c60b5b9c594d3d (patch)
treea597c1d5f05a1af8d3da499510a1a0e922b94bd3 /contrib/tcp_wrappers
parent54345fd41bbe91db9411f88932ea2f30315705ca (diff)
downloadFreeBSD-src-7478417f78b0803432f1cc1834c60b5b9c594d3d.zip
FreeBSD-src-7478417f78b0803432f1cc1834c60b5b9c594d3d.tar.gz
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
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 0a24aca..3fa1f5b 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)
OpenPOWER on IntegriCloud