diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-05-14 09:48:50 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-05-14 09:48:50 +0000 |
commit | 6b9a220c3ce8db4d71854fe88ab579e56259926d (patch) | |
tree | 2a4af69adf9df57313eb0cdb4bee326e2a97e0f6 /lib/libcurses | |
parent | 16c2220d2985d628f7824dc6e26e1165c1cb0900 (diff) |
buf oflows
Diffstat (limited to 'lib/libcurses')
-rw-r--r-- | lib/libcurses/lib_mvcur.c | 10 |
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); |