From owner-freebsd-fs@FreeBSD.ORG Mon Sep 23 18:02:24 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E73CE484; Mon, 23 Sep 2013 18:02:24 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [IPv6:2001:5a8:4:7e72:4a5b:39ff:fe12:452]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C53182E9A; Mon, 23 Sep 2013 18:02:24 +0000 (UTC) Received: from chez.mckusick.com (localhost [127.0.0.1]) by chez.mckusick.com (8.14.3/8.14.3) with ESMTP id r8NI2KmF083133; Mon, 23 Sep 2013 11:02:20 -0700 (PDT) (envelope-from mckusick@chez.mckusick.com) Message-Id: <201309231802.r8NI2KmF083133@chez.mckusick.com> To: sbruno@freebsd.org, Sean Bruno Subject: Re: kern/vfs_mount.c vfs_donmount() checks of MFSNAMELEN In-reply-to: <1379951941.1612.3.camel@localhost> Date: Mon, 23 Sep 2013 11:02:20 -0700 From: Kirk McKusick Cc: freebsd-fs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2013 18:02:25 -0000 > From: Sean Bruno > Subject: kern/vfs_mount.c vfs_donmount() checks of MFSNAMELEN > To: freebsd-fs > Date: Mon, 23 Sep 2013 08:59:01 -0700 > > 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