From owner-svn-src-all@freebsd.org Fri Jul 6 15:01:12 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E061102F7E3; Fri, 6 Jul 2018 15:01:12 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A73E584E02; Fri, 6 Jul 2018 15:01:11 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (67-0-234-146.albq.qwest.net [67.0.234.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 015FD1AF637; Fri, 6 Jul 2018 07:10:41 +0000 (UTC) Subject: Re: svn commit: r336031 - head/usr.bin/top To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Daichi GOTO References: <201807061322.w66DMjRG084523@repo.freebsd.org> <1530888553.57805.8.camel@freebsd.org> From: Sean Bruno Openpgp: preference=signencrypt Autocrypt: addr=sbruno@freebsd.org; prefer-encrypt=mutual; keydata= xsBNBFk+0UEBCADaf4bgxxKvMOhRV5NPoGWRCCGm49d6+1VFNlQ77WsY/+Zvf95TPULdRlnG w648KfxWt7+O3kdKhdRwnqlXWC7zA2Qt0dRE1yIqOGJ4jp4INvp/bcxWzgr0aoKOjrlnfxRV bh+s0rzdZt6TsNL3cVYxkC8oezjaUkHdW4mFJU249U1QJogkF8g0FeKNfEcjEkwJNX6lQJH+ EzCWT0NCk6J+Xyo+zOOljxPp1OUfdvZi3ulkU/qTZstGVWxFVsP8xQklV/y3AFcbIYx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2xzgklTLuDgS73MM120mM7ao9AQUeWiSle/H0UCK7xPOzC/aeUC4oygDQKAfkkNbCNTo3+A qDjBRA8qx0e9a/QjDL+RFgD4L5kLT4tToY8T8HaBp8h03LBfk510IaI8oL/Jg7vpM3PDtJMW tUi2H+yNFmL3NfM2oBToWKLFsoP54f/eeeImrNnrlLjLHPzqS+/9apgYqX2Jwiv3tHBc4FTO GuY8VvF7BpixJs8Pc2RUuCfSyodrp1YG1kRGlXAH0cqwwr0Zmk4+7dZvtVQMCl6kS6q1+84q JwtItxS2eXSEA4NO0sQ3BXUywANh Message-ID: <20e05842-cbfb-671c-5532-c57514346bf5@freebsd.org> Date: Fri, 6 Jul 2018 09:01:06 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1530888553.57805.8.camel@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="l04QF4mS7mUZ5NP2REeAABoNUtpw6rCgr" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 15:01:12 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --l04QF4mS7mUZ5NP2REeAABoNUtpw6rCgr Content-Type: multipart/mixed; boundary="S2Dfyt8HaULkhmptpzK0Gnpwp2g8dL1np"; protected-headers="v1" From: Sean Bruno To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Daichi GOTO Message-ID: <20e05842-cbfb-671c-5532-c57514346bf5@freebsd.org> Subject: Re: svn commit: r336031 - head/usr.bin/top References: <201807061322.w66DMjRG084523@repo.freebsd.org> <1530888553.57805.8.camel@freebsd.org> In-Reply-To: <1530888553.57805.8.camel@freebsd.org> --S2Dfyt8HaULkhmptpzK0Gnpwp2g8dL1np Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 07/06/18 08:49, Ian Lepore wrote: > On Fri, 2018-07-06 at 13:22 +0000, Sean Bruno wrote: >> Author: sbruno >> Date: Fri Jul=C2=A0=C2=A06 13:22:44 2018 >> New Revision: 336031 >> URL: https://svnweb.freebsd.org/changeset/base/336031 >> >> Log: >> =C2=A0 r336028 changed next_msg to a char * from char [] of fixed size= =2E=C2=A0=C2=A0Change >> =C2=A0 2nd argument of vsnprintf() to get the strlen of next_msg so th= at the >> =C2=A0 appropriate size is used. >> =C2=A0=C2=A0 >> =C2=A0 Found with gcc. >> =C2=A0=C2=A0 >> =C2=A0 /usr.bin/top/display.c: In function 'new_message': >> =C2=A0 /usr.bin/top/display.c:963:31: error: >> =C2=A0 argument to 'sizeof' in 'vsnprintf' call is the same expression= as the >> =C2=A0 destination; did you mean to provide an explicit length? >> =C2=A0 [-Werror=3Dsizeof-pointer-memaccess] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0vsnprintf(next_msg, sizeof(n= ext_msg), msgfmt, args); >> =C2=A0=C2=A0 >> =C2=A0 Reviewed by: daichi >> >> Modified: >> =C2=A0 head/usr.bin/top/display.c >> >> Modified: head/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=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/usr.bin/top/display.c Fri Jul=C2=A0=C2=A06 12:44:48 2018 (r33= 6030) >> +++ head/usr.bin/top/display.c Fri Jul=C2=A0=C2=A06 13:22:44 2018 (r33= 6031) >> @@ -960,7 +960,7 @@ new_message(int type, const char *msgfmt, ...) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0va_start(args, msgfmt); >> =C2=A0 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* first, format the message */ >> -=C2=A0=C2=A0=C2=A0=C2=A0vsnprintf(next_msg, sizeof(next_msg), msgfmt,= args); >> +=C2=A0=C2=A0=C2=A0=C2=A0vsnprintf(next_msg, strlen(next_msg), msgfmt,= args); >> =C2=A0 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0va_end(args); >> =C2=A0 >> >=20 > This fix is incorrect. The original commit that changed next_msg to a > pointer is probably flawed enough to revert and redevelop rather than > try a rolling set of bandaid fixes. >=20 > Whenever setup_buffer() creates a new buffer it will need to store the > size it allocated for use in this vsnprintf() call (and maybe other > places that write directly into next_msg without calling setup_buffer > to reallocate it first, I didn't look). The setup_buffer_bufsiz > variable isn't quite right as-is, because it doesn't include the > 'addlen' value passed to setup_buffer(). >=20 > -- Ian >=20 >=20 Yeah, this isn't going well. I've been poking around in it and I can't see an quick way to do this correctly. sean --S2Dfyt8HaULkhmptpzK0Gnpwp2g8dL1np-- --l04QF4mS7mUZ5NP2REeAABoNUtpw6rCgr 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/hDJfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEU4 QzRFOUY4ODAzNTA0RTFFM0Y0QkEzNEJERTRGNUZFODlCNUZDQjYACgkQveT1/om1 /LZFhQgAtAzQ1F/dvMyKwUd6jJ+3Rmbq/yhgQ4P8nO593aD9Mz6taZ9GR2eCviAK Cw1FpvJy/DCdNDiOYylJbl8sneZPr0ykMUiKEk9O1KS/nyVCnBCenpd/PMbxi2MQ GIVZ0GXSH2PRyB7gmfn369g04SEhR+fGElshY0A0WTr84ah8B6fXl7KpWASYMgKz YMAFcMBGi1vkfKJv5KcftkcXO7zID2uNmukCDMh4tS7+PWJnBwR8V3Db7DUZV0Sc 1mxNS+dDVKXBbJAzB/cqupAKmIdRMu493IuA/CYxzGFOOWl8+fuG7QoULY0u8aW0 Cu1xjSfUR6Q6k+km02oaCrtvTXxx7A== =hm+D -----END PGP SIGNATURE----- --l04QF4mS7mUZ5NP2REeAABoNUtpw6rCgr--