Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Aug 2011 14:40:27 GMT
From:      Robert Millan <rmh@debian.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/159357: ZFS MAXNAMELEN macro has confusing name (off-by-one)
Message-ID:  <201108011440.p71EeRjW003879@red.freebsd.org>
Resent-Message-ID: <201108011450.p71EoAiA022918@freefall.freebsd.org>

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

>Number:         159357
>Category:       misc
>Synopsis:       ZFS MAXNAMELEN macro has confusing name (off-by-one)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 01 14:50:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Robert Millan
>Release:        FreeBSD 8.2
>Organization:
>Environment:
>Description:

It's not clear what MAXNAMELEN in ZFS compat environment means. Name indicates it's the maximum name length (for ZFS objects), but actual checks error out when requested name has the maximum length. In practice this makes it the maximum plus one:

./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (dsl_dataset_namelen(ds) + 1 + strlen(snapname) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (dsl_dir_namelen(ds->ds_dir) + 1 + strlen(newsnapname) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (strlen(oldname) + delta >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:   if (strlcat(zc->zc_name, "@", sizeof (zc->zc_name)) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:           if (strlen(propname) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:    if (strlen(propname) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:            if (strlen(nvpair_name(elem)) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (strlen(path) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (p-path >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (p-path >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(path) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(path) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:              if (end - start >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(pool) >= MAXNAMELEN) {
./cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:     } else if (p - volname >= ZFS_MAXNAMELEN) {
./cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c:                  if (strlen(nvpair_name(elem)) >= ZAP_MAXNAMELEN) {

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



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