summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-16 23:24:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-16 23:24:59 +0000
commit6e1571bb9ddafb00c4fc3986d78d9453df546018 (patch)
tree316b8648082e192ac84df06e552153159d128380 /usr.sbin
parented30ec5a685aac0ab351efc58b6c7e37a2219303 (diff)
buf oflow; from dholland@hcs.harvard.edu
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rwhod/rwhod.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c
index 423f7fc78b0..631ba54b439 100644
--- a/usr.sbin/rwhod/rwhod.c
+++ b/usr.sbin/rwhod/rwhod.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$Id: rwhod.c,v 1.1 1995/10/18 08:48:07 deraadt Exp $";
+static char rcsid[] = "$Id: rwhod.c,v 1.2 1996/08/16 23:24:58 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -193,12 +193,13 @@ main(argc, argv)
continue;
if (wd.wd_type != WHODTYPE_STATUS)
continue;
+ wd.wd_hostname[sizeof(wd.wd_hostname)-1] = '\0';
if (!verify(wd.wd_hostname)) {
syslog(LOG_WARNING, "malformed host name from %x",
from.sin_addr);
continue;
}
- (void) sprintf(path, "whod.%s", wd.wd_hostname);
+ (void) snprintf(path, sizeof path, "whod.%s", wd.wd_hostname);
/*
* Rather than truncating and growing the file each time,
* use ftruncate if size is less than previous size.