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 <eugen grosbein.pp.ru>

Modified:
  stable/8/sbin/fsck_ffs/dir.c
Directory Properties:
  stable/8/sbin/fsck_ffs/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/7/sbin/fsck_ffs/dir.c
Directory Properties:
  stable/7/sbin/fsck_ffs/   (props changed)

Modified: stable/8/sbin/fsck_ffs/dir.c
==============================================================================
--- stable/8/sbin/fsck_ffs/dir.c        Fri Sep 16 04:42:05 2011        
(r225604)
+++ stable/8/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++)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to