From owner-svn-src-head@freebsd.org Sat Jul 7 04:42:32 2018 Return-Path: Delivered-To: svn-src-head@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 DB02F1033038; Sat, 7 Jul 2018 04:42:31 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 39CB582467; Sat, 7 Jul 2018 04:42:30 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id bf37fj3RBbP3Ibf38fY2RL; Fri, 06 Jul 2018 22:42:23 -0600 X-Authority-Analysis: v=2.3 cv=P64UeBIu c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=R9QF1RCXAYgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=0SNF9felXnpvx8fNHRkA:9 a=FGpEXLuv19PSDgP7:21 a=FYxN6gWI4VtkaOeG:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id A310B123; Fri, 6 Jul 2018 21:42:20 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w674gJcQ025508; Fri, 6 Jul 2018 21:42:19 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w674gJVr025505; Fri, 6 Jul 2018 21:42:19 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201807070442.w674gJVr025505@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Konstantin Belousov cc: Sean Bruno , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r336031 - head/usr.bin/top In-Reply-To: Message from Konstantin Belousov of "Fri, 06 Jul 2018 16:56:34 +0300." <20180706135634.GP5562@kib.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 06 Jul 2018 21:42:19 -0700 X-CMAE-Envelope: MS4wfBDtlnhpi1XN+09+AaktrRcCy9UzSTmX9dkF8FE1QpTZk08TyePEOGR1NhVOTnbsyyMuUJr9vCS+cXlglJtr61OYIO1LI/DoVKDeinUuIfP8RoPUHwMa rmT1iF8WF/sZn7lVl+y6PqIRmw7aShZmwhbbZPiMLaVIiR1+wBp13b6Z+SeyBh2XifK7vqiZTz69F56uLpnGvFscYgQIvuV7kJqEVjErKT3+l9X+NgHZW7A0 L6SvwPktT85WTDuYVpiSiiq34lg8Zmz8jsMixP5DXSonOS1Tqe5a5+R+6ks42owHPoxXrhqblbt08c7shb1N2A== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2018 04:42:32 -0000 In message <20180706135634.GP5562@kib.kiev.ua>, Konstantin Belousov writes: > On Fri, Jul 06, 2018 at 01:22:44PM +0000, Sean Bruno wrote: > > Author: sbruno > > Date: Fri Jul 6 13:22:44 2018 > > New Revision: 336031 > > URL: https://svnweb.freebsd.org/changeset/base/336031 > > > > Log: > > r336028 changed next_msg to a char * from char [] of fixed size. Change > > 2nd argument of vsnprintf() to get the strlen of next_msg so that the > > appropriate size is used. > > > > Found with gcc. > > > > /usr.bin/top/display.c: In function 'new_message': > > /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); > > > > Reviewed by: daichi > > > > Modified: > > head/usr.bin/top/display.c > > > > Modified: head/usr.bin/top/display.c > > =========================================================================== > === > > --- head/usr.bin/top/display.c Fri Jul 6 12:44:48 2018 (r33603 > 0) > > +++ head/usr.bin/top/display.c Fri Jul 6 13:22:44 2018 (r33603 > 1) > > @@ -960,7 +960,7 @@ new_message(int type, const char *msgfmt, ...) > > va_start(args, msgfmt); > > > > /* first, format the message */ > > - vsnprintf(next_msg, sizeof(next_msg), msgfmt, args); > > + vsnprintf(next_msg, strlen(next_msg), msgfmt, args); > I highly suspect that this strlen() call returns zero, always. Yes. OTOH sizeof(next_msg) won't return much useful either, as it returns the size of the pointer. > > > > > va_end(args); > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.