Page MenuHomeFreeBSD

D61593.1794858211.diff
No OneTemporary

Authored By
Unknown
Size
703 B
Referenced Files
None
Subscribers
None

D61593.1794858211.diff

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

Mime Type
text/plain
Expires
Mon, Nov 16, 7:43 PM (10 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41772145
Default Alt Text
D61593.1794858211.diff (703 B)

Event Timeline