summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:48:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:48:17 +0000
commit79063e917d2c22333489f5d0660feb440dc09fc4 (patch)
tree8d2497ff361059ff651ed5a9ae8234fc697735a3 /usr.bin
parentab6678d163ea6c72709947b2f9258dc0735672d4 (diff)
avoid buf oflows
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/main.c6
-rw-r--r--usr.bin/systat/netstat.c6
-rw-r--r--usr.bin/systat/swap.c7
3 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index d1ee81a9481..a19ef23e3eb 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.4 1996/06/26 05:40:08 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $ */
/* $NetBSD: main.c,v 1.8 1996/05/10 23:16:36 thorpej Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: main.c,v 1.4 1996/06/26 05:40:08 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -300,7 +300,7 @@ error(fmt, va_alist)
if (wnd) {
getyx(stdscr, oy, ox);
- (void) vsprintf(buf, fmt, ap);
+ (void) vsnprintf(buf, sizeof buf, fmt, ap);
clrtoeol();
standout();
mvaddstr(CMDLINE, 0, buf);
diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c
index 4e5e0d2d941..bccc93f97b6 100644
--- a/usr.bin/systat/netstat.c
+++ b/usr.bin/systat/netstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netstat.c,v 1.4 1996/07/27 14:55:25 deraadt Exp $ */
+/* $OpenBSD: netstat.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $ */
/* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: netstat.c,v 1.4 1996/07/27 14:55:25 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: netstat.c,v 1.5 1996/08/06 18:48:15 deraadt Exp $";
#endif /* not lint */
/*
@@ -435,7 +435,7 @@ inetname(in)
if (in.s_addr == INADDR_ANY)
strcpy(line, "*");
else if (cp)
- strcpy(line, cp);
+ strncpy(line, cp, sizeof line);
else {
in.s_addr = ntohl(in.s_addr);
#define C(x) ((x) & 0xff)
diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c
index 9c40fa92148..f16e601299f 100644
--- a/usr.bin/systat/swap.c
+++ b/usr.bin/systat/swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swap.c,v 1.4 1996/06/26 05:40:11 deraadt Exp $ */
+/* $OpenBSD: swap.c,v 1.5 1996/08/06 18:48:16 deraadt Exp $ */
/* $NetBSD: swap.c,v 1.5 1996/05/10 23:16:38 thorpej Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95";
#endif
-static char rcsid[] = "$OpenBSD: swap.c,v 1.4 1996/06/26 05:40:11 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: swap.c,v 1.5 1996/08/06 18:48:16 deraadt Exp $";
#endif /* not lint */
/*
@@ -128,6 +128,9 @@ initswap()
strcpy(msgbuf, "systat: swap: cannot find");
for (i = 0; syms[i].n_name != NULL; i++) {
if (syms[i].n_value == 0) {
+ if (strlen(msgbuf) strlen(syms[i].n_name) +2 >
+ sizeof (msgbuf))
+ continue;
strcat(msgbuf, " ");
strcat(msgbuf, syms[i].n_name);
}