Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177620050
D61593.1794857739.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
703 B
Referenced Files
None
Subscribers
None
D61593.1794857739.diff
View Options
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
--- a/usr.bin/top/display.c
+++ b/usr.bin/top/display.c
@@ -57,7 +57,7 @@
static int last_hi = 0; /* used in u_process and u_endscreen */
static int lastline = 0;
-#define lineindex(l) ((l)*screen_width)
+#define lineindex(l) ((l)*(screen_width + 1))
/* things initialized by display_init and used thruout */
@@ -143,8 +143,8 @@
if (lines < 0)
lines = 0;
- /* now, allocate space for the screen buffer */
- screenbuf = calloc(lines, screen_width);
+ /* allocate space for each line, including its terminating NUL */
+ screenbuf = calloc(lines, screen_width + 1);
if (screenbuf == NULL)
{
/* oops! */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 7:35 PM (10 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41772145
Default Alt Text
D61593.1794857739.diff (703 B)
Attached To
Mode
D61593: top: fix off-by-one in screenbuf
Attached
Detach File
Event Timeline