summaryrefslogtreecommitdiffstats
path: root/libblkid
diff options
context:
space:
mode:
authorJindrich Makovicka2011-07-24 14:12:06 +0200
committerKarel Zak2011-07-26 12:02:22 +0200
commit5ec1ee6d8ef2d2f0abf64eb0a52d63a2f6bb8252 (patch)
treeec3d1ce6340043833968e2cfe279b46e0d296baa /libblkid
parentscriptreplay: fix buffer overflow (diff)
downloadkernel-qcow2-util-linux-5ec1ee6d8ef2d2f0abf64eb0a52d63a2f6bb8252.tar.gz
kernel-qcow2-util-linux-5ec1ee6d8ef2d2f0abf64eb0a52d63a2f6bb8252.tar.xz
kernel-qcow2-util-linux-5ec1ee6d8ef2d2f0abf64eb0a52d63a2f6bb8252.zip
libblkid: use 64bit offset in search_fat_label to avoid truncation
[kzak@redhat.com: - use %jd for the offset in debug message] Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid')
-rw-r--r--libblkid/src/superblocks/vfat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libblkid/src/superblocks/vfat.c b/libblkid/src/superblocks/vfat.c
index 1584efae9..ab036f45d 100644
--- a/libblkid/src/superblocks/vfat.c
+++ b/libblkid/src/superblocks/vfat.c
@@ -118,14 +118,14 @@ static const char *no_name = "NO NAME ";
* Look for LABEL (name) in the FAT root directory.
*/
static unsigned char *search_fat_label(blkid_probe pr,
- uint32_t offset, uint32_t entries)
+ uint64_t offset, uint32_t entries)
{
struct vfat_dir_entry *ent, *dir = NULL;
int i;
DBG(DEBUG_LOWPROBE,
printf("\tlook for label in root-dir "
- "(entries: %d, offset: %d)\n", entries, offset));
+ "(entries: %d, offset: %jd)\n", entries, offset));
if (!blkid_probe_is_tiny(pr)) {
/* large disk, read whole root directory */
@@ -336,7 +336,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
int count;
next_sect_off = (next - 2) * vs->vs_cluster_size;
- next_off = (start_data_sect + next_sect_off) *
+ next_off = (uint64_t)(start_data_sect + next_sect_off) *
sector_size;
count = buf_size / sizeof(struct vfat_dir_entry);