From owner-freebsd-bugs Sun Feb 18 13: 0: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8F7E637B401 for ; Sun, 18 Feb 2001 13:00:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f1IL03E90603; Sun, 18 Feb 2001 13:00:03 -0800 (PST) (envelope-from gnats) Date: Sun, 18 Feb 2001 13:00:03 -0800 (PST) Message-Id: <200102182100.f1IL03E90603@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Edwin Groothuis Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount it Reply-To: Edwin Groothuis Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/25067; it has been noted by GNATS. From: Edwin Groothuis To: freebsd-gnats-submit@FreeBSD.org Cc: clefevre@poboxes.com Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount it Date: Sun, 18 Feb 2001 21:56:52 +0100 > >Fix: This is a small patch for it: --- /old/cd9660_vfsops.c Sun Feb 18 22:28:23 2001 +++ /usr/src/sys/isofs/cd9660/cd9660_vfsops.c Sun Feb 18 22:26:51 2001 @@ -188,6 +188,12 @@ cd9660_mount(mp, path, data, ndp, p) mode_t accessmode; struct iso_mnt *imp = 0; + /* + * Do not allow paths-names bigger than MNAMELEN characters. + */ + if (strlen(path) >= MNAMELEN) + return (ENAMETOOLONG); + if ((mp->mnt_flag & MNT_ROOTFS) != 0) { return (iso_mountroot(mp, p)); } --- /old/vfs_syscalls.c Sun Feb 18 22:28:23 2001 +++ /usr/src/sys/kern/vfs_syscalls.c Sun Feb 18 22:27:12 2001 @@ -133,6 +133,13 @@ mount1(p, uap, segflag) if (usermount == 0 && (error = suser(p))) return (error); + + /* + * Do not allow paths-names bigger than MNAMELEN characters. + */ + if (strlen(uap->path) >= MNAMELEN) + return (ENAMETOOLONG); + /* * Do not allow NFS export by non-root users. */ This works for cdrom-based and for "general" filesystems (ufs, msdos, procfs..., actually, everything handled in the kernel) As soon as you try to mount something like you gave in your example now it gives: [~] root@p6>mount /dev/vn0c /a/very_very_very_very_very_very_very_very_long_pathname_with_more_than_80_characters mount: File name too long Maximum lenght of a mount-path (for i386) is 79 characters (buffer is 80, one for the padding 0), for alpha it's 71 characters (untested, but I assume it's the same kind of idea) Edwin -- Edwin Groothuis | Interested in MUDs? Visit Fatal Dimensions: mavetju@chello.nl | http://fataldimensions.nl.eu.org/ ------------------+ telnet://fataldimensions.nl.eu.org:4000 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message