Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2018 07:04:22 -0600
From:      Sean Bruno <sbruno@freebsd.org>
To:        Daichi GOTO <daichi@FreeBSD.org>, 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:  <75ee54a3-1436-0e4c-57a7-8585ca12039e@freebsd.org>
In-Reply-To: <201807061207.w66C76CR043533@repo.freebsd.org>
References:  <201807061207.w66C76CR043533@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--NbiJt2XlrQKrRxBbdRzWfmgzJjUJNPxA7
Content-Type: multipart/mixed; boundary="4UbMHIS7MLe7mLjHypgIAwuMj7XUk8OuN";
 protected-headers="v1"
From: Sean Bruno <sbruno@freebsd.org>
To: Daichi GOTO <daichi@FreeBSD.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Message-ID: <75ee54a3-1436-0e4c-57a7-8585ca12039e@freebsd.org>
Subject: Re: svn commit: r336028 - head/usr.bin/top
References: <201807061207.w66C76CR043533@repo.freebsd.org>
In-Reply-To: <201807061207.w66C76CR043533@repo.freebsd.org>

--4UbMHIS7MLe7mLjHypgIAwuMj7XUk8OuN
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable



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 dis=
played
>     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=3Dsizeof-pointer-memaccess]
     vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);


I think this needs to be changed

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);

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

     va_end(args);


--4UbMHIS7MLe7mLjHypgIAwuMj7XUk8OuN--

--NbiJt2XlrQKrRxBbdRzWfmgzJjUJNPxA7
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEE6MTp+IA1BOHj9Lo0veT1/om1/LYFAls/aNZfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4
QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1
/LYf+wf/bSz4Tr7BacV5E2wdaeki8ER4rpak8sOq0+NAfytQaVu7Z1q/mq9MrzvH
rUD2/FpwfpE8B5hrzS97oi75jvql7/NmHGkqOHumw1yHqR8psWTnCkufFhmMvblf
0bHBd8uq7r4g6lo0v4CfCCUqv8/nOB+kfQf64Bys+zsZ1qZPUWikjsJUtY1CerNN
yq6N7ey5qtNyeYYGLU4TVan64rXDW6hPgyUU7Zb3Upfpw4N9Tuu7jxzLFWtoYueV
jLGZ4izoxbi7THeSyW99rJPJi6Zb/9qNjDu58jo+hk60KHvBasLDsvOpNcq6SnFn
YDJiIKSYBiqjj0e7dJ74iYShW4lyOQ==
=hp0Q
-----END PGP SIGNATURE-----

--NbiJt2XlrQKrRxBbdRzWfmgzJjUJNPxA7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75ee54a3-1436-0e4c-57a7-8585ca12039e>