aboutsummaryrefslogtreecommitdiff
path: root/contrib/top/screen.c
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>1997-12-04 02:54:05 +0000
committerWarner Losh <imp@FreeBSD.org>1997-12-04 02:54:05 +0000
commiteb064071a1d9c2b0be162ca76fb42024b28ef8d2 (patch)
treee34d07a221904ef624cb20782d8861c6c79f4147 /contrib/top/screen.c
parent861570bb45ef42ce7e658ebb46a5261d164606ac (diff)
downloadsrc-eb064071a1d9c2b0be162ca76fb42024b28ef8d2.tar.gz
src-eb064071a1d9c2b0be162ca76fb42024b28ef8d2.zip
Buffer overflow from bitblt's commit to OpenBSD. Committed here for lack
of a better place to do it. Reviewed by: joerge Obtained from: OpenBSD
Notes
Notes: svn path=/head/; revision=31520
Diffstat (limited to 'contrib/top/screen.c')
-rw-r--r--contrib/top/screen.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/top/screen.c b/contrib/top/screen.c
index b5d038831748..531a4f3244a3 100644
--- a/contrib/top/screen.c
+++ b/contrib/top/screen.c
@@ -204,7 +204,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 */
@@ -420,7 +421,9 @@ get_screensize()
#endif /* TIOCGSIZE */
#endif /* TIOCGWINSZ */
- (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';
}
standout(msg)