Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2013 15:33:19 -0700
From:      Sean Bruno <sean_bruno@yahoo.com>
To:        Kirk McKusick <mckusick@mckusick.com>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: kern/vfs_mount.c vfs_donmount() checks of MFSNAMELEN
Message-ID:  <1379975599.1593.10.camel@localhost>
In-Reply-To: <201309231802.r8NI2KmF083133@chez.mckusick.com>
References:  <201309231802.r8NI2KmF083133@chez.mckusick.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Mon, 2013-09-23 at 11:02 -0700, Kirk McKusick wrote:
> > So, I'm confused by this check:
> > 
> >         if (fstypelen >= MFSNAMELEN - 1 || fspathlen >= MNAMELEN -
> 1) {
> >                 error = ENAMETOOLONG;
> >                 goto bail;
> >         }
> > 
> > MFSNAMELEN is 16, why do we check against >= MFSNAMELEN - 1?  Why
> dont
> > we check against (> MFSNAMELEN - 1) or (>= MFSNAMELEN)?  Is a 14
> > character fstypelen with a "\0" at the end considered too long?
> > 
> > Sean
> > 
> > p.s. e.g. mount -t fuse.glusterfs ...
> 
> I agree with you. It should either be (> MFSNAMELEN - 1) or (>=
> MFSNAMELEN).
> 
>         Kirk McKusick 

Not sure if we should adjust MNAMELEN or not too while we're at it, I
need to do a bit more of a code audit before thunking that one.

Propsed patch to set fstyplen check:
Index: sys/kern/vfs_mount.c
===================================================================
--- sys/kern/vfs_mount.c	(revision 255831)
+++ sys/kern/vfs_mount.c	(working copy)
@@ -656,7 +656,7 @@
 	 * variables will fit in our mp buffers, including the
 	 * terminating NUL.
 	 */
-	if (fstypelen >= MFSNAMELEN - 1 || fspathlen >= MNAMELEN - 1) {
+	if (fstypelen >= MFSNAMELEN || fspathlen >= MNAMELEN - 1) {
 		error = ENAMETOOLONG;
 		goto bail;
 	}




[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (FreeBSD)

iQEcBAABAgAGBQJSQMGvAAoJEBkJRdwI6BaHimIIAIr5zfdMeMcwtPltANSNazEo
T9XvxkgZtNs3GnvmPoY6WdlD6g2gUPIRWs9Ue+xzlwAsvMvFzrISOBj26nLdq17g
T2x/S1usoqT5BRPjsXBo1pchLDWDk6171nx/OS3vAd0fzKQ9etO4ziwV2rerMBBO
Oe80L3m/tBZo/e20ZSD/+B7eNsGHR1JDOwqfxTw0Utpnc3UUfYpnymiNIMyESrfR
iUTFuOurcHG2vpncDyhy6rDn7i4oeZLn6dHRcubVm9ZNeuiHibzo8vdVOrgtNS8T
FL+munqot5VSwYTN9i4SQ7ry0Nx77geo232B0wN74ao6fUz0pHvgdOBHLE3TFGA=
=CiU4
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1379975599.1593.10.camel>