From owner-freebsd-fs@FreeBSD.ORG Tue Jul 9 16:57:03 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 69F0C7E9; Tue, 9 Jul 2013 16:57:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id D5E551D0C; Tue, 9 Jul 2013 16:57:02 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r69Gux9a077444; Tue, 9 Jul 2013 19:56:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r69Gux9a077444 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r69GuxkU077443; Tue, 9 Jul 2013 19:56:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 9 Jul 2013 19:56:59 +0300 From: Konstantin Belousov To: Robert Millan Subject: Re: Compatibility options for mount(8) Message-ID: <20130709165658.GO91021@kib.kiev.ua> References: <20130702000732.GA72587@icarus.home.lan> <20130709150129.GA8289@icarus.home.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="g7MhQE0aLFS2f2WM" Content-Disposition: inline In-Reply-To: <20130709150129.GA8289@icarus.home.lan> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home 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 16:57:03 -0000 --g7MhQE0aLFS2f2WM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 09, 2013 at 08:01:29AM -0700, Jeremy Chadwick wrote: > 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 str= cmp() > > > 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) =3D=3D 0)= { > >=20 > > What is the rationale behind this? >=20 > 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). Robert, please ignore this. The person does not know what he talks about. The use of strncmp() is plain wrong. E.g., it would match "remount1" as well as any longer option starting with "remount". Original patch is fine. --g7MhQE0aLFS2f2WM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR3EDaAAoJEJDCuSvBvK1B048P/RxRZHYXHbofTOyg0zJx7ORl xi+qaeHQACvjMAwQSUsmCQLb+zz6bN5fYuB26aXRoWjmKkUhVzcLpb/9vAcIXZ46 JPxbNMnR817dJ+pCqt/pX0LTKAGJX9QIdwoEfG9w0G82VOOf8/G1X9Q4BK0YJj4x 6W/gCqd5Ps5j3TewQAg+NHtGq0xFVPCGHEM7oM91xONSVHm7IWRatOMV7ph8oU4d HsFt/BREsWX+5TcC0zL1FWi+PFt0OQi5gDBBAVid7+9iCe8/oDkEUBCTy5VPJJLc gfvi8RefZJtODFzbUes8l89cJMWktKohISupQQ+jtaGvSLg/8PjyyONqeZcU0fIU HooFHvtIMlo8cYTbu7ubetUfANZrhEoXj8rYe5aUE2ZZV1uRPq92xWcKS8w8fBkk p89olpxcufwkKWpzgfH0lSSw/OZdobOuZhQOhnh4+EulY0MdVRxEJuCWHm0PuoP5 dPpILPtYolIYhJo1nOfI20v50O6XD//kItlAD7fpRCb7KWjlvItCzYGBnugiRvBl pK4o+PIHmn6QVtorQYlxaRLFbBURdFz3vzLWAUPO7mMsH3YOzG9GBSstvELqUBbK J+KBceG9hnO7r3vCXE9595J3hZIKEl9jPkM0X5WVOPNl4tJjThjFsyXbK1vqkIBj UbBKncSUN9LiYdv/M9ob =ekgr -----END PGP SIGNATURE----- --g7MhQE0aLFS2f2WM--