Module Name: src Committed By: christos Date: Tue Sep 27 01:42:46 UTC 2011
Modified Files: src/sys/kern: vfs_lookup.c Log Message: use KERNEL_NAME_MAX to enforce the same limit to names as before, and make sure that MAXNAMLEN == NAME_MAX To generate a diff of this commit: cvs rdiff -u -r1.190 -r1.191 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.190 src/sys/kern/vfs_lookup.c:1.191 --- src/sys/kern/vfs_lookup.c:1.190 Thu Sep 1 11:31:27 2011 +++ src/sys/kern/vfs_lookup.c Mon Sep 26 21:42:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.190 2011/09/01 15:31:27 yamt Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.191 2011/09/27 01:42:45 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.190 2011/09/01 15:31:27 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.191 2011/09/27 01:42:45 christos Exp $"); #include "opt_magiclinks.h" @@ -63,6 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c int vfs_magiclinks = MAGICLINKS; +__CTASSERT(MAXNAMLEN == NAME_MAX); + /* * Substitute replacement text for 'magic' strings in symlinks. * Returns 0 if successful, and returns non-zero if an error @@ -810,7 +812,7 @@ lookup_parsepath(struct namei_state *sta cp = NULL; cnp->cn_hash = namei_hash(cnp->cn_nameptr, &cp); cnp->cn_namelen = cp - cnp->cn_nameptr; - if (cnp->cn_namelen > NAME_MAX) { + if (cnp->cn_namelen > KERNEL_NAME_MAX) { return ENAMETOOLONG; } #ifdef NAMEI_DIAGNOSTIC @@ -1545,7 +1547,7 @@ do_lookup_for_nfsd_index(struct namei_st cp = NULL; cnp->cn_hash = namei_hash(cnp->cn_nameptr, &cp); cnp->cn_namelen = cp - cnp->cn_nameptr; - KASSERT(cnp->cn_namelen <= NAME_MAX); + KASSERT(cnp->cn_namelen <= KERNEL_NAME_MAX); ndp->ni_pathlen -= cnp->cn_namelen; ndp->ni_next = cp; state->slashes = 0; @@ -1606,7 +1608,7 @@ lookup_for_nfsd_index(struct nameidata * * Note: the name sent in here (is not|should not be) allowed * to contain a slash. */ - if (strlen(ndp->ni_pathbuf->pb_path) > NAME_MAX) { + if (strlen(ndp->ni_pathbuf->pb_path) > KERNEL_NAME_MAX) { return ENAMETOOLONG; } if (strchr(ndp->ni_pathbuf->pb_path, '/')) {