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

This commit is contained in:
simonb 2002-05-09 02:55:49 +00:00
parent 5457f78a34
commit 1d08e313ae
4 changed files with 15 additions and 13 deletions

View File

@ -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 @@ dircheck(idesc, dp)
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++ == '/'))

View File

@ -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 @@ dircheck(idesc, dp)
}
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++)

View File

@ -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 @@ dircheck(struct inodesc * idesc, struct direct * dp)
# 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);

View File

@ -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 @@ putdir(buf, size)
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 @@ putdir(buf, size)
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;