summaryrefslogtreecommitdiff
path: root/usr.bin/systat/keyboard.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-25 01:46:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-25 01:46:57 +0000
commit1adbb70b0b5d937b0f6995abe94c5bbefe4d77bd (patch)
tree82d7c7df5ba5cad97eefff84970255869f52d272 /usr.bin/systat/keyboard.c
parent3d2b2ce19ee10db16ccca9522d1a2da76c4b0967 (diff)
buffer overflow prevention
Diffstat (limited to 'usr.bin/systat/keyboard.c')
-rw-r--r--usr.bin/systat/keyboard.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c
index 1487659d085..a8b7178d31c 100644
--- a/usr.bin/systat/keyboard.c
+++ b/usr.bin/systat/keyboard.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyboard.c,v 1.2 1996/06/26 05:40:07 deraadt Exp $ */
+/* $OpenBSD: keyboard.c,v 1.3 1996/07/25 01:46:56 deraadt Exp $ */
/* $NetBSD: keyboard.c,v 1.2 1995/01/20 08:51:59 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: keyboard.c,v 1.2 1996/06/26 05:40:07 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: keyboard.c,v 1.3 1996/07/25 01:46:56 deraadt Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -110,6 +110,11 @@ keyboard()
clrtoeol();
continue;
}
+ if (col >= sizeof(line)) {
+ /* line too long */
+ beep();
+ continue;
+ }
if (isprint(ch) || ch == ' ') {
line[col] = ch;
mvaddch(CMDLINE, col, ch);