summaryrefslogtreecommitdiff
path: root/lib/libcurses
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-14 09:48:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-05-14 09:48:50 +0000
commit6b9a220c3ce8db4d71854fe88ab579e56259926d (patch)
tree2a4af69adf9df57313eb0cdb4bee326e2a97e0f6 /lib/libcurses
parent16c2220d2985d628f7824dc6e26e1165c1cb0900 (diff)
buf oflows
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/lib_mvcur.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libcurses/lib_mvcur.c b/lib/libcurses/lib_mvcur.c
index 203d0692253..8979d65b4ed 100644
--- a/lib/libcurses/lib_mvcur.c
+++ b/lib/libcurses/lib_mvcur.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_mvcur.c,v 1.6 1997/12/03 05:21:24 millert Exp $ */
+/* $OpenBSD: lib_mvcur.c,v 1.7 1998/05/14 09:48:49 deraadt Exp $ */
/***************************************************************************
@@ -969,6 +969,10 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
{
int fy, fx, ty, tx, n, i;
char buf[BUFSIZ], capname[BUFSIZ];
+ char tparsebuf[20], tparsebuf[20];
+
+ snprintf(tparsebuf, sizeof tparsebuf, "l %%%ds", sizeof tname);
+ snprintf(cparsebuf, sizeof cparsebuf, "d %%%ds", sizeof capname);
(void) fputs("> ", stdout);
(void) fgets(buf, sizeof(buf), stdin);
@@ -1020,11 +1024,11 @@ int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED)
tname[sizeof(tname) - 1] = '\0';
load_term();
}
- else if (sscanf(buf, "l %s", tname) == 1)
+ else if (sscanf(buf, tparsebuf, tname) == 1)
{
load_term();
}
- else if (sscanf(buf, "d %s", capname) == 1)
+ else if (sscanf(buf, cparsebuf, capname) == 1)
{
struct name_table_entry const *np = _nc_find_entry(capname,
_nc_info_hash_table);