summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-08-16 23:24:58 +0000
committerderaadt <deraadt@openbsd.org>1996-08-16 23:24:58 +0000
commit6dbbbab849fa24854aa84713b03faa5ac830dccb (patch)
tree0218e6d47d3b4106cdf9edc06551215799a320f7
parentonly safe ioctl (diff)
downloadwireguard-openbsd-6dbbbab849fa24854aa84713b03faa5ac830dccb.tar.xz
wireguard-openbsd-6dbbbab849fa24854aa84713b03faa5ac830dccb.zip
buf oflow; from dholland@hcs.harvard.edu
-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 8a1accd50d9..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.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.