Add NI_NAMEREQD flag to getnameinfo() call. Without this flag,
getnameinfo() don't return error at name resolving failure. But it is used at doaddrlookup(-N) case in telnet, error need to be returned to correctly initialize hostname buffer. Discovered at checking recent KAME repository change, noticed by itojun.
This commit is contained in:
parent
ac0711e123
commit
0bd288cd6c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56870
@ -2451,7 +2451,7 @@ tn(argc, argv)
|
||||
if (doaddrlookup)
|
||||
gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len,
|
||||
_hostname, sizeof(_hostname) - 1, NULL, 0,
|
||||
0);
|
||||
NI_NAMEREQD);
|
||||
if (gni_err != 0)
|
||||
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
|
||||
_hostname[sizeof(_hostname)-1] = '\0';
|
||||
|
@ -2451,7 +2451,7 @@ tn(argc, argv)
|
||||
if (doaddrlookup)
|
||||
gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len,
|
||||
_hostname, sizeof(_hostname) - 1, NULL, 0,
|
||||
0);
|
||||
NI_NAMEREQD);
|
||||
if (gni_err != 0)
|
||||
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
|
||||
_hostname[sizeof(_hostname)-1] = '\0';
|
||||
|
@ -2274,7 +2274,7 @@ tn(argc, argv)
|
||||
if (doaddrlookup)
|
||||
gni_err = getnameinfo(res->ai_addr, res->ai_addr->sa_len,
|
||||
_hostname, sizeof(_hostname) - 1, NULL, 0,
|
||||
0);
|
||||
NI_NAMEREQD);
|
||||
if (gni_err != 0)
|
||||
(void) strncpy(_hostname, hostp, sizeof(_hostname) - 1);
|
||||
_hostname[sizeof(_hostname)-1] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user