mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Don't assume ai0->ai_canonname will always be filled in. Print the
user-supplied host name if we can't get a canonical name. Obtained from: contrib/tcp_wrappers/socket.c rev. 1.4 (in spirit)
This commit is contained in:
parent
fd2802cfe0
commit
2804330f1a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66315
@ -96,7 +96,12 @@ netfinger(name)
|
||||
}
|
||||
|
||||
multi = (ai0->ai_next) != 0;
|
||||
printf("[%s]\n", ai0->ai_canonname);
|
||||
|
||||
/* ai_canonname may not be filled in if the user specified an IP. */
|
||||
if (ai0->ai_canonname == 0)
|
||||
printf("[%s]\n", host);
|
||||
else
|
||||
printf("[%s]\n", ai0->ai_canonname);
|
||||
|
||||
for (ai = ai0; ai != 0; ai = ai->ai_next) {
|
||||
if (multi)
|
||||
|
Loading…
Reference in New Issue
Block a user