From owner-svn-src-head@FreeBSD.ORG Mon Nov 10 10:11:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1082410656A7; Mon, 10 Nov 2008 10:11:54 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B25858FC25; Mon, 10 Nov 2008 10:11:53 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id C496B6D43F; Mon, 10 Nov 2008 10:11:52 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id A8ED284497; Mon, 10 Nov 2008 11:11:52 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kostik Belousov References: <200811090644.mA96ira1032670@svn.freebsd.org> <20081109132026.GL18100@deviant.kiev.zoral.com.ua> Date: Mon, 10 Nov 2008 11:11:52 +0100 In-Reply-To: <20081109132026.GL18100@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Sun, 9 Nov 2008 15:20:26 +0200") Message-ID: <86wsfb51qv.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Matteo Riondato , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184779 - head/usr.sbin/cron/crontab X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 10 Nov 2008 10:11:56 -0000 Kostik Belousov writes: > Matteo Riondato writes: > > - (void) sprintf(n, CRON_TAB(User)); > > + (void) snprintf(n, sizeof(n), CRON_TAB(User)); > This note is probably also about paranoia instead of exploitable bug. > I think that it is better to use %s format explicitely instead of > expecting no '%' in the CRON_TAB(User). Better still would be to replace the vile CRON_TAB() macro with a function: static inline int cron_tab(char *str, size_t len, const char *user) { return (snprintf(str, len, "%s/%s", SPOOL_DIR, user)) } DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no