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

--=-5AbKzWkXOapOU3sB4/Oo
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

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

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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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 >=3D MFSNAMELEN - 1 || fspathlen >=3D MNAMELEN - 1) {
+	if (fstypelen >=3D MFSNAMELEN || fspathlen >=3D MNAMELEN - 1) {
 		error =3D ENAMETOOLONG;
 		goto bail;
 	}




--=-5AbKzWkXOapOU3sB4/Oo
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

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

--=-5AbKzWkXOapOU3sB4/Oo--




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