From owner-freebsd-stable@FreeBSD.ORG Thu Feb 5 01:33:51 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D77622DB for ; Thu, 5 Feb 2015 01:33:51 +0000 (UTC) Received: from alogt.com (alogt.com [69.36.191.58]) (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 B0E74A42 for ; Thu, 5 Feb 2015 01:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=Rhf07NNBMCjtrUa6tVkcUQe+hiZBUHCEC35lYLfJmqY=; b=xGq6bMgUs0uVvWM2FAgE/IxYcE7et7HPkgC29kb+rk1YLB+9ZliCqSguTTbBdNpgoXLyVrv3hAAHK70MvbIDX0GLaa6z0sGCMBgSHRnKHnZafyJ1O6pk9Q/5xUdVcs/7hIm+kaK1H4M9Bs0YcNJK3qfsPH2I4H6YrulmvtGILq8=; Received: from [114.124.39.245] (port=33223 helo=B85M-HD3-0.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1YJBK9-001gHy-Hg; Wed, 04 Feb 2015 18:33:45 -0700 Date: Thu, 5 Feb 2015 09:33:31 +0800 From: Erich Dollansky To: John-Mark Gurney Subject: Re: top, fixed buffer length in utils.c Message-ID: <20150205093331.1bb876e1@B85M-HD3-0.alogt.com> In-Reply-To: <20150204183548.GA27763@funkthat.com> References: <20150201175159.7fa88d16@B85M-HD3-0.alogt.com> <20150203003307.GG27103@funkthat.com> <20150203200135.57c8c236@B85M-HD3-0.alogt.com> <20150204074235.GX27103@funkthat.com> <20150204170947.17764dff@B85M-HD3-0.alogt.com> <20150204183548.GA27763@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 01:33:51 -0000 Hi, On Wed, 4 Feb 2015 10:35:48 -0800 John-Mark Gurney wrote: > Erich Dollansky wrote this message on Wed, Feb 04, 2015 at 17:09 > +0800: > > Hi, > > > > On Tue, 3 Feb 2015 23:42:35 -0800 > > John-Mark Gurney wrote: > > > > > Ok, I've generated this patch: > > > Index: utils.c > > > =================================================================== > > > --- utils.c (revision 277938) > > > +++ utils.c (working copy) > > > @@ -58,6 +58,7 @@ char *str; > > > * ever convert will be 2^32-1, > > > which is 10 > > > * digits. > > > */ > > > +_Static_assert(sizeof(int) <= 4, "buffer too small for this sized > > > int"); > > > char *itoa(val) > > > > > Wait, shouldn't it the other way around? It will break when sizeof > > (int) is greater than 4? > > No, asserts trigger when the statement is false... I verified this > by changing 4 to 2 and seeing that it failed (triggered) to compile... > so, I learned something new with FreeBSD. I never use them as we have a set of macros from a time long before these kind of macros came up and never changed. You know, never change w winning team. Erich