From owner-freebsd-fs@FreeBSD.ORG Tue Jul 9 15:02:21 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9128E84E; Tue, 9 Jul 2013 15:02:21 +0000 (UTC) (envelope-from jdc@koitsu.org) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by mx1.freebsd.org (Postfix) with ESMTP id 4F2FE1625; Tue, 9 Jul 2013 15:02:21 +0000 (UTC) Received: from mfilter16-d.gandi.net (mfilter16-d.gandi.net [217.70.178.144]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 6CB3AA80D1; Tue, 9 Jul 2013 17:02:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter16-d.gandi.net Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by mfilter16-d.gandi.net (mfilter16-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id hvmYYwxcxdKr; Tue, 9 Jul 2013 17:01:32 +0200 (CEST) X-Originating-IP: 76.102.14.35 Received: from jdc.koitsu.org (c-76-102-14-35.hsd1.ca.comcast.net [76.102.14.35]) (Authenticated sender: jdc@koitsu.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 91CA0A80C6; Tue, 9 Jul 2013 17:01:32 +0200 (CEST) Received: by icarus.home.lan (Postfix, from userid 1000) id 1534B73A31; Tue, 9 Jul 2013 08:01:29 -0700 (PDT) Date: Tue, 9 Jul 2013 08:01:29 -0700 From: Jeremy Chadwick To: Robert Millan Subject: Re: Compatibility options for mount(8) Message-ID: <20130709150129.GA8289@icarus.home.lan> References: <20130702000732.GA72587@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2013 15:02:21 -0000 On Tue, Jul 09, 2013 at 04:47:46PM +0200, Robert Millan wrote: > > 2. Please use strncmp(). I know other parts of the same code use strcmp() > > and those should really be improved at some other time, but while you're > > already there you might as well use strncmp() (you'll see others have > > done the same), i.e.: > > > > } else if (strncmp(p, "remount", 7) == 0) { > > What is the rationale behind this? Primarily security and stability. I won't get into a discussion about this as it'll just bikeshed, particularly when there's an almost indefinite amount of information online about the dangers of strcmp(3). -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Making life hard for others since 1977. PGP 4BD6C0CB |