diff options
author | Jeroen Oortwijn | 2010-03-09 23:15:30 +0100 |
---|---|---|
committer | Karel Zak | 2010-03-11 14:34:00 +0100 |
commit | af109b063aa15866a0570920586d79417d7a7a67 (patch) | |
tree | a822eec2418f246bc1a5d43a6a4ce96c41eae23c /shlibs/blkid | |
parent | umount: add --fake option to umount(8) (diff) | |
download | kernel-qcow2-util-linux-af109b063aa15866a0570920586d79417d7a7a67.tar.gz kernel-qcow2-util-linux-af109b063aa15866a0570920586d79417d7a7a67.tar.xz kernel-qcow2-util-linux-af109b063aa15866a0570920586d79417d7a7a67.zip |
libblkid: prevent overflow in BeFS
Prevent overflow by casting values to blkid_loff_t before applying
block shift.
Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
Diffstat (limited to 'shlibs/blkid')
-rw-r--r-- | shlibs/blkid/src/superblocks/befs.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/shlibs/blkid/src/superblocks/befs.c b/shlibs/blkid/src/superblocks/befs.c index b341402ad..c238bae3c 100644 --- a/shlibs/blkid/src/superblocks/befs.c +++ b/shlibs/blkid/src/superblocks/befs.c @@ -123,13 +123,13 @@ static int probe_befs(blkid_probe pr, const struct blkid_idmag *mag) return -1; bi = (struct befs_inode *) blkid_probe_get_buffer(pr, - (FS32_TO_CPU(bs->root_dir.allocation_group, fs_le) - << FS32_TO_CPU(bs->ag_shift, fs_le) - << FS32_TO_CPU(bs->block_shift, fs_le)) - + (FS16_TO_CPU(bs->root_dir.start, fs_le) - << FS32_TO_CPU(bs->block_shift, fs_le)), - FS16_TO_CPU(bs->root_dir.len, fs_le) - << FS32_TO_CPU(bs->block_shift, fs_le)); + ((blkid_loff_t)FS32_TO_CPU(bs->root_dir.allocation_group, fs_le) + << FS32_TO_CPU(bs->ag_shift, fs_le) + << FS32_TO_CPU(bs->block_shift, fs_le)) + + ((blkid_loff_t)FS16_TO_CPU(bs->root_dir.start, fs_le) + << FS32_TO_CPU(bs->block_shift, fs_le)), + (blkid_loff_t)FS16_TO_CPU(bs->root_dir.len, fs_le) + << FS32_TO_CPU(bs->block_shift, fs_le)); if (!bi) return -1; |