diff options
author | 1997-12-02 17:56:30 +0000 | |
---|---|---|
committer | 1997-12-02 17:56:30 +0000 | |
commit | 4c7b8e4cfa2002efd37bd9215bfdf124cfcf90bb (patch) | |
tree | 160790fb2163ccfa0d1e67e0ff2a038aec8aad1f | |
parent | Fix deadlock in cd9660 code. NetBSD PR#2262 (diff) | |
download | wireguard-openbsd-4c7b8e4cfa2002efd37bd9215bfdf124cfcf90bb.tar.xz wireguard-openbsd-4c7b8e4cfa2002efd37bd9215bfdf124cfcf90bb.zip |
watch those overflows
-rw-r--r-- | usr.bin/top/screen.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/top/screen.c b/usr.bin/top/screen.c index d72dad1c4f0..60024314263 100644 --- a/usr.bin/top/screen.c +++ b/usr.bin/top/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.4 1997/09/16 19:25:00 weingart Exp $ */ +/* $OpenBSD: screen.c,v 1.5 1997/12/02 17:56:30 bitblt Exp $ */ /* * Top users/processes display for Unix @@ -168,7 +168,8 @@ int interactive; PC = (PCptr = tgetstr("pc", &bufptr)) ? *PCptr : 0; /* set convenience strings */ - (void) strcpy(home, tgoto(cursor_motion, 0, 0)); + (void) strncpy(home, tgoto(cursor_motion, 0, 0), sizeof (home) -1); + home[sizeof (home) -1] = 0; /* (lower_left is set in get_screensize) */ /* get the actual screen size with an ioctl, if needed */ @@ -269,7 +270,9 @@ void get_screensize() } } - (void) strcpy(lower_left, tgoto(cursor_motion, 0, screen_length - 1)); + (void) strncpy(lower_left, tgoto(cursor_motion, 0, screen_length - 1), + sizeof (lower_left) -1); + lower_left[sizeof(lower_left) -1] = 0; } void standout(msg) |