summaryrefslogtreecommitdiff
path: root/lib/libtermlib
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-06-21 04:26:12 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-06-21 04:26:12 +0000
commitdc0fe2eb841ed6cc764c3fe8c032b3d2bc37abbc (patch)
treeadb6f269d7de2eb77dfe31049d75511b6afcd6ad /lib/libtermlib
parent461806abb10d0e9bc7b64885a0cfe0aeb1022212 (diff)
WHen called with a buffer (throug tgetent(3)), never type to copy more than
1023 bytes into the passed buffer. Always make sure the buffer is NUL- terminated after copying a terminal description entry into it as well.
Diffstat (limited to 'lib/libtermlib')
-rw-r--r--lib/libtermlib/getterm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libtermlib/getterm.c b/lib/libtermlib/getterm.c
index 3b50c6b354d..fbef236b7e7 100644
--- a/lib/libtermlib/getterm.c
+++ b/lib/libtermlib/getterm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getterm.c,v 1.3 1996/06/18 20:40:22 tholo Exp $ */
+/* $OpenBSD: getterm.c,v 1.4 1996/06/21 04:26:11 tholo Exp $ */
/*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: getterm.c,v 1.3 1996/06/18 20:40:22 tholo Exp $";
+static char rcsid[] = "$OpenBSD: getterm.c,v 1.4 1996/06/21 04:26:11 tholo Exp $";
#endif
#include <stdlib.h>
@@ -183,8 +183,10 @@ _ti_getterm(name)
}
}
_ti_fillcap(cur_term);
- if (_ti_buf)
- strcpy(_ti_buf, dummy);
+ if (_ti_buf) {
+ strncpy(_ti_buf, dummy, 1023);
+ _ti_buf[1023] = '\0';
+ }
UP = cursor_up;
BC = backspace_if_not_bs;
PC = pad_char ? pad_char[0] : '\0';