Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin Don't bother testing if a uint8_t is > 256 -- that test...



details:   https://anonhg.NetBSD.org/src/rev/6974973bf451
branches:  trunk
changeset: 526712:6974973bf451
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu May 09 02:55:49 2002 +0000

description:
Don't bother testing if a uint8_t is > 256 -- that test is always false.

diffstat:

 sbin/fsck_ext2fs/dir.c |   8 ++++----
 sbin/fsck_ffs/dir.c    |   6 +++---
 sbin/fsck_lfs/dir.c    |   4 ++--
 sbin/restore/dirs.c    |  10 ++++++----
 4 files changed, 15 insertions(+), 13 deletions(-)

diffs (116 lines):

diff -r d6daa8b63a68 -r 6974973bf451 sbin/fsck_ext2fs/dir.c
--- a/sbin/fsck_ext2fs/dir.c    Thu May 09 02:44:39 2002 +0000
+++ b/sbin/fsck_ext2fs/dir.c    Thu May 09 02:55:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $   */
+/*     $NetBSD: dir.c,v 1.6 2002/05/09 02:55:49 simonb Exp $   */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c      8.5 (Berkeley) 12/8/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $");
+__RCSID("$NetBSD: dir.c,v 1.6 2002/05/09 02:55:49 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -251,8 +251,8 @@
                        return (1);
        size = EXT2FS_DIRSIZ(dp->e2d_namlen);
        if (reclen < size ||
-           idesc->id_filesize < size ||
-           dp->e2d_namlen > EXT2FS_MAXNAMLEN)
+           idesc->id_filesize < size /* ||
+           dp->e2d_namlen > EXT2FS_MAXNAMLEN */)
                return (0);
        for (cp = dp->e2d_name, size = 0; size < dp->e2d_namlen; size++)
                if (*cp == '\0' || (*cp++ == '/'))
diff -r d6daa8b63a68 -r 6974973bf451 sbin/fsck_ffs/dir.c
--- a/sbin/fsck_ffs/dir.c       Thu May 09 02:44:39 2002 +0000
+++ b/sbin/fsck_ffs/dir.c       Thu May 09 02:55:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.32 2001/01/23 02:35:51 mycroft Exp $ */
+/*     $NetBSD: dir.c,v 1.33 2002/05/09 02:55:50 simonb Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c      8.8 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: dir.c,v 1.32 2001/01/23 02:35:51 mycroft Exp $");
+__RCSID("$NetBSD: dir.c,v 1.33 2002/05/09 02:55:50 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -326,7 +326,7 @@
                }
        if (iswap16(dp->d_reclen) < size ||
            idesc->id_filesize < size ||
-           namlen > MAXNAMLEN ||
+           /* namlen > MAXNAMLEN || */
            type > 15)
                return (0);
        for (cp = dp->d_name, size = 0; size < namlen; size++)
diff -r d6daa8b63a68 -r 6974973bf451 sbin/fsck_lfs/dir.c
--- a/sbin/fsck_lfs/dir.c       Thu May 09 02:44:39 2002 +0000
+++ b/sbin/fsck_lfs/dir.c       Thu May 09 02:55:49 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.5 2001/07/13 20:30:18 perseant Exp $      */
+/* $NetBSD: dir.c,v 1.6 2002/05/09 02:55:50 simonb Exp $        */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -265,7 +265,7 @@
 #      endif
        if (dp->d_reclen < size ||
            idesc->id_filesize < size ||
-           namlen > MAXNAMLEN ||
+           /* namlen > MAXNAMLEN || */
            type > 15) {
                printf("reclen<size, filesize<size, namlen too large, or type>15\n");
                return (0);
diff -r d6daa8b63a68 -r 6974973bf451 sbin/restore/dirs.c
--- a/sbin/restore/dirs.c       Thu May 09 02:44:39 2002 +0000
+++ b/sbin/restore/dirs.c       Thu May 09 02:55:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dirs.c,v 1.36 2002/01/04 06:48:49 lukem Exp $  */
+/*     $NetBSD: dirs.c,v 1.37 2002/05/09 02:55:50 simonb Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)dirs.c     8.7 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: dirs.c,v 1.36 2002/01/04 06:48:49 lukem Exp $");
+__RCSID("$NetBSD: dirs.c,v 1.37 2002/05/09 02:55:50 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -384,8 +384,8 @@
                        i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1));
                        if ((dp->d_reclen & 0x3) != 0 ||
                            dp->d_reclen > i ||
-                           dp->d_reclen < DIRSIZ(0, dp, 0) ||
-                           dp->d_namlen > NAME_MAX) {
+                           dp->d_reclen < DIRSIZ(0, dp, 0) /* ||
+                           dp->d_namlen > NAME_MAX */) {
                                vprintf(stdout, "Mangled directory: ");
                                if ((dp->d_reclen & 0x3) != 0)
                                        vprintf(stdout,
@@ -394,10 +394,12 @@
                                        vprintf(stdout,
                                           "reclen less than DIRSIZ (%d < %lu) ",
                                           dp->d_reclen, (u_long)DIRSIZ(0, dp, 0));
+#if 0  /* dp->d_namlen is a uint8_t, always < NAME_MAX */
                                if (dp->d_namlen > NAME_MAX)
                                        vprintf(stdout,
                                           "reclen name too big (%d > %d) ",
                                           dp->d_namlen, NAME_MAX);
+#endif
                                vprintf(stdout, "\n");
                                loc += i;
                                continue;



Home | Main Index | Thread Index | Old Index