Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jul 2018 22:12:13 +0900
From:      =?utf-8?B?5b6M6Jek5aSn5Zyw?= <daichigoto@icloud.com>
To:        Sean Bruno <sbruno@freebsd.org>
Cc:        Daichi GOTO <daichi@FreeBSD.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336028 - head/usr.bin/top
Message-ID:  <F9DBB500-1885-40EE-9895-3E9446694658@icloud.com>
In-Reply-To: <75ee54a3-1436-0e4c-57a7-8585ca12039e@freebsd.org>
References:  <201807061207.w66C76CR043533@repo.freebsd.org> <75ee54a3-1436-0e4c-57a7-8585ca12039e@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Surely. I think your advice is appropriate.
Could you please commit?

> 2018/07/06 22:04=E3=80=81Sean Bruno <sbruno@freebsd.org>=E3=81=AE=E3=83=A1=
=E3=83=BC=E3=83=AB:
>=20
>=20
>=20
> On 07/06/18 06:07, Daichi GOTO wrote:
>> -static char next_msg[MAX_COLS + 5];
>> +static char *next_msg =3D NULL;
>> static int msglen =3D 0;
>> /* Invariant: msglen is always the length of the message currently =
displayed
>>    on the screen (even when next_msg doesn't contain that message). =
*/
>=20
> 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=3Dsizeof-pointer-memaccess]
>     vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
>=20
>=20
> I think this needs to be changed
>=20
> Index: usr.bin/top/display.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- usr.bin/top/display.c       (revision 336029)
> +++ usr.bin/top/display.c       (working copy)
> @@ -960,7 +960,7 @@
>     va_start(args, msgfmt);
>=20
>     /* first, format the message */
> -    vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
> +    vsnprintf(next_msg, strlen(next_msg), msgfmt, args);
>=20
>     va_end(args);
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F9DBB500-1885-40EE-9895-3E9446694658>