Page MenuHomeFreeBSD

D16174.id45007.diff
No OneTemporary

D16174.id45007.diff

Index: usr.bin/top/display.c
===================================================================
--- usr.bin/top/display.c
+++ usr.bin/top/display.c
@@ -703,16 +703,17 @@
* respect to screen updates).
*/
+#define NEXT_MSG_ADDLEN 5
static char *next_msg = NULL;
static int msglen = 0;
/* Invariant: msglen is always the length of the message currently displayed
on the screen (even when next_msg doesn't contain that message). */
void
i_message(void)
{
- next_msg = setup_buffer(next_msg, 5);
+ next_msg = setup_buffer(next_msg, NEXT_MSG_ADDLEN);
while (lastline < y_message)
{
fputc('\n', stdout);
@@ -960,10 +961,11 @@
va_start(args, msgfmt);
/* first, format the message */
- vsnprintf(next_msg, strlen(next_msg), msgfmt, args);
+ vsnprintf(next_msg, setup_buffer_bufsiz + NEXT_MSG_ADDLEN,
+ msgfmt, args);
va_end(args);
if (msglen > 0)
{
/* message there already -- can we clear it? */
@@ -1350,23 +1352,23 @@
if (NULL == buffer) {
setup_buffer_bufsiz = screen_width;
- b = calloc(setup_buffer_bufsiz + addlen, sizeof(char));
+ b = calloc(setup_buffer_bufsiz + addlen + 2, sizeof(char));
} else {
if (screen_width > setup_buffer_bufsiz) {
setup_buffer_bufsiz = screen_width;
free(buffer);
- b = calloc(setup_buffer_bufsiz + addlen,
+ b = calloc(setup_buffer_bufsiz + addlen + 2,
sizeof(char));
} else {
b = buffer;
}
}
if (NULL == b) {
fprintf(stderr, "%s: can't allocate sufficient memory\n",
myname);
exit(4);
}
return b;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 13, 9:43 AM (7 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36622648
Default Alt Text
D16174.id45007.diff (1 KB)

Event Timeline