Compatibility options for mount(8)

Konstantin Belousov kostikbel at gmail.com
Tue Jul 9 16:57:03 UTC 2013


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 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).

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130709/b9e06380/attachment.sig>


More information about the freebsd-fs mailing list