From owner-svn-src-all@FreeBSD.ORG Fri Sep 16 05:45:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E9A106566C; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 407298FC0C; Fri, 16 Sep 2011 05:45:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G5jE9N006259; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G5jE2B006257; Fri, 16 Sep 2011 05:45:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109160545.p8G5jE2B006257@svn.freebsd.org> From: Xin LI Date: Fri, 16 Sep 2011 05:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225605 - in stable: 7/sbin/fsck_ffs 8/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2011 05:45:14 -0000 Author: delphij Date: Fri Sep 16 05:45:13 2011 New Revision: 225605 URL: http://svn.freebsd.org/changeset/base/225605 Log: MFC r225338: Fix the check in dircheck() on namlen. The value of namlen is copied from on-disk d_namlen, which is a 8-bit unsigned integer which can never exceed MAXNAMLEN (255) so the test is always true. Moreover, UFS does not allow d_namelen being zero. Change namlen from u_int to u_int8_t, and replace the unneeded test with a useful test. PR: bin/160339 Submitted by: Eugene Grosbein Modified: stable/7/sbin/fsck_ffs/dir.c Directory Properties: stable/7/sbin/fsck_ffs/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sbin/fsck_ffs/dir.c Directory Properties: stable/8/sbin/fsck_ffs/ (props changed) Modified: stable/7/sbin/fsck_ffs/dir.c ============================================================================== --- stable/7/sbin/fsck_ffs/dir.c Fri Sep 16 04:42:05 2011 (r225604) +++ stable/7/sbin/fsck_ffs/dir.c Fri Sep 16 05:45:13 2011 (r225605) @@ -210,7 +210,7 @@ dircheck(struct inodesc *idesc, struct d size_t size; char *cp; u_char type; - u_int namlen; + u_int8_t namlen; int spaceleft; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); @@ -225,7 +225,7 @@ dircheck(struct inodesc *idesc, struct d type = dp->d_type; if (dp->d_reclen < size || idesc->id_filesize < size || - namlen > MAXNAMLEN || + namlen == 0 || type > 15) goto bad; for (cp = dp->d_name, size = 0; size < namlen; size++)