svn commit: r336028 - head/usr.bin/top
後藤大地
daichigoto at icloud.com
Fri Jul 6 13:12:28 UTC 2018
Surely. I think your advice is appropriate.
Could you please commit?
> 2018/07/06 22:04、Sean Bruno <sbruno at freebsd.org>のメール:
>
>
>
> 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);
>
More information about the svn-src-head
mailing list