Date: Sun, 18 Feb 2001 13:00:03 -0800 (PST) From: Edwin Groothuis <mavetju@chello.nl> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/25067: able to mount a pathname > 80 char. but unable to unmount it Message-ID: <200102182100.f1IL03E90603@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/25067; it has been noted by GNATS. From: Edwin Groothuis <mavetju@chello.nl> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102182100.f1IL03E90603>