diff options
| author | Warner Losh <imp@FreeBSD.org> | 1996-11-01 06:29:34 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 1996-11-01 06:29:34 +0000 |
| commit | 471595b02cb6f82eabf21a63dcb354516fd4567a (patch) | |
| tree | 6cda7818c9592d8e8faa8973600f3d736d8b76b1 /usr.sbin/rwhod | |
| parent | c293d821b3220de377d5bedc2d4452a7f0c1858f (diff) | |
Notes
Diffstat (limited to 'usr.sbin/rwhod')
| -rw-r--r-- | usr.sbin/rwhod/rwhod.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index c5605e2e48a7c..4aa54984110b1 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -223,7 +223,8 @@ usage: fprintf(stderr, "usage: rwhod [ -m [ ttl ] ]\n"); } if ((cp = index(myname, '.')) != NULL) *cp = '\0'; - strncpy(mywd.wd_hostname, myname, sizeof(myname) - 1); + strncpy(mywd.wd_hostname, myname, sizeof(mywd.wd_hostname) - 1); + mywd.wd_hostname[sizeof(mywd.wd_hostname) - 1] = '\0'; utmpf = open(_PATH_UTMP, O_RDONLY|O_CREAT, 0644); if (utmpf < 0) { syslog(LOG_ERR, "%s: %m", _PATH_UTMP); @@ -351,7 +352,7 @@ verify(name, maxlen) { register int size = 0; - while (*name && size < maxlen) { + while (*name && size < maxlen - 1) { if (!isascii(*name) || !(isalnum(*name) || ispunct(*name))) return (0); name++, size++; |
