On 07/06/18 06:07, Daichi GOTO wrote:
> -static char next_msg[MAX_COLS + 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). */

gcc noticed that a later call to vsnprintf() now has some problems.
/home/sbruno/bsd/wifi/fbsd_head/usr.bin/top/display.c: In function
'new_message':
/home/sbruno/bsd/wifi/fbsd_head/usr.bin/top/display.c:963:31: error:
argument to 'sizeof' in 'vsnprintf' call is the same expression as the
destination; did you mean to provide an explicit length?
[-Werror=sizeof-pointer-memaccess]
     vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);


I think this needs to be changed

Index: usr.bin/top/display.c
===================================================================
--- usr.bin/top/display.c       (revision 336029)
+++ usr.bin/top/display.c       (working copy)
@@ -960,7 +960,7 @@
     va_start(args, msgfmt);

     /* first, format the message */
-    vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
+    vsnprintf(next_msg, strlen(next_msg), msgfmt, args);

     va_end(args);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to