From owner-svn-src-all@FreeBSD.ORG Sun Oct 16 18:39:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD0FF106567A for ; Sun, 16 Oct 2011 18:39:11 +0000 (UTC) (envelope-from bounces+73574-8822-svn-src-all=freebsd.org@sendgrid.me) Received: from o2.shared.sendgrid.net (o2.shared.sendgrid.net [74.63.235.152]) by mx1.freebsd.org (Postfix) with SMTP id 945EE8FC15 for ; Sun, 16 Oct 2011 18:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h= message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=Aok4ZANUptSZF/k6pBjI3PMACp8=; b=F0b4te2vR1a+JachKlzRlFpLIzHj l/34QLN2+ZYLQtUQDfEUpU7Ec22dDYVdlePIzHyWDpHNje0MgkPHVnwq6Wta850p NGI4Vw1TAQINtWjlRTqecUYjNonuIPkTLNz5Wy0dYgr5uXgaeJOZg2gBC1q0Enz+ RtXboMYExf2k+sQ= Received: by 10.8.49.96 with SMTP id mf44.27880.4E9B24CE10 Sun, 16 Oct 2011 13:39:10 -0500 (CDT) Received: from mail.tarsnap.com (unknown [10.9.180.5]) by mi10 (SG) with ESMTP id 4e9b24ce.e7c.1217c47 for ; Sun, 16 Oct 2011 13:39:10 -0500 (CST) Received: (qmail 56256 invoked from network); 16 Oct 2011 18:36:51 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by mail.tarsnap.com with ESMTP; 16 Oct 2011 18:36:51 -0000 Received: (qmail 78187 invoked from network); 16 Oct 2011 18:38:40 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 16 Oct 2011 18:38:40 -0000 Message-ID: <4E9B24B0.60106@freebsd.org> Date: Sun, 16 Oct 2011 11:38:40 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0.2) Gecko/20110914 Thunderbird/6.0.2 MIME-Version: 1.0 To: Ed Schouten References: <201110140724.p9E7OmMB052118@svn.freebsd.org> <4E9B1287.4050507@freebsd.org> <20111016182033.GS91943@hoeg.nl> In-Reply-To: <20111016182033.GS91943@hoeg.nl> X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Sendgrid-EID: A6W2xSVPHetogaU8rnzccWwgBYtN+QvIzXyjfe/10PGWq5JTZXdwYRai3TdLtBxi37ZSTa4K2Y2xCjp2cS4WN1j2fbGD8iqM9qvF4QROUsU4I6gwnpXvSTWIYIPr4LQHS/3Ya9vbQece7LGy0D/OkoE9MnroNbfDlUXhqOZ/93E= Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226359 - head/usr.bin/look X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 16 Oct 2011 18:39:12 -0000 On 10/16/11 11:20, Ed Schouten wrote: > Hmmm... Casting to size_t is not the way to go, but off_t also should be > avoided. We can assume st_size is non-negative, so we should do > something like this, right? > > - if (sb.st_size > (off_t)SIZE_T_MAX) > + if ((uintmax_t)sb.st_size > (uintmax_t)SIZE_T_MAX) That should work. I've also solved this problem in the past with if ((sizeof(off_t) > sizeof(size_t)) && (sb.st_size > (off_t) -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid