summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1999-04-07 08:39:54 +0000
committerBrian Somers <brian@FreeBSD.org>1999-04-07 08:39:54 +0000
commitaae211bc7efadbb7fc97f5a78a8b5640a2f72e16 (patch)
treeb92bb762958aa8259a0fd93352a3863a22842e30 /libexec
parent9e9a43bdec3ff0ad37e4799b209e0d9513150a6f (diff)
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/telnetd/telnetd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index fd4b6da7bd78..d8019ed86702 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -817,11 +817,15 @@ doit(who)
#endif /* _SC_CRAY_SECURE_SYS */
/* get name of connected client */
- if (realhostname(remote_hostname, utmp_len,
+ if (realhostname(remote_hostname, sizeof(remote_hostname) - 1,
&who->sin_addr) == HOSTNAME_INVALIDADDR && registerd_host_only)
fatal(net, "Couldn't resolve your address into a host name.\r\n\
Please contact your net administrator");
- remote_hostname[utmp_len] = '\0';
+ remote_hostname[sizeof(remote_hostname) - 1] = '\0';
+
+ if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len)
+ strncpy(remote_hostname, inet_ntoa(who->sin_addr),
+ sizeof(remote_hostname) - 1);
(void) gethostname(host_name, sizeof(host_name) - 1);
host_name[sizeof(host_name) - 1] = '\0';