summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-08-10 04:43:25 +0000
committerRoland McGrath <roland@gnu.org>2001-08-10 04:43:25 +0000
commitff09a44bc18177ba1253a8d3e1c9fbe3ebe5b768 (patch)
treedeb80de086fff2a51b7d7355c47cf28e714f19a7
parenta9061b45e38b08af2c8d04f5bf1994a93d536779 (diff)
2001-08-09 Roland McGrath <roland@frob.com>
* inode.c (diskfs_get_translator): Fail with EFTYPE if the length field stored on disk is unreasonable. Don't crash on ENOMEM. Use memcpy instead of bcopy.
-rw-r--r--ext2fs/inode.c2
-rw-r--r--ufs/inode.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index a3483c00..12e249e4 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -726,7 +726,7 @@ diskfs_get_translator (struct node *np, char **namep, unsigned *namelen)
datalen =
((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] << 8);
- if (datalen > block_size)
+ if (datalen > block_size - 2)
err = EFTYPE; /* ? */
else
{
diff --git a/ufs/inode.c b/ufs/inode.c
index 28f18dbd..2098211f 100644
--- a/ufs/inode.c
+++ b/ufs/inode.c
@@ -613,7 +613,7 @@ diskfs_get_translator (struct node *np, char **namep, u_int *namelen)
transloc = disk_image + fsaddr (sblock, blkno);
datalen = *(u_int *)transloc;
- if (datalen > sblock->fs_bsize)
+ if (datalen > sblock->fs_bsize - sizeof (u_int))
err = EFTYPE;
else
{