]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: use blkid_probe_get_buffer() more carefully
authorKarel Zak <kzak@redhat.com>
Wed, 16 Mar 2011 13:06:23 +0000 (14:06 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Mar 2011 13:06:23 +0000 (14:06 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/superblocks/hfs.c
shlibs/blkid/src/superblocks/udf.c
shlibs/blkid/src/superblocks/vfat.c

index 033a65dea24f9100e284bf9f924cdfcc8acd2ee8..aa9da0ce66989d73e18754893ea775396c595231 100644 (file)
@@ -229,7 +229,7 @@ static int probe_hfsplus(blkid_probe pr, const struct blkid_idmag *mag)
        cat_block = be32_to_cpu(extents[0].start_block);
 
        buf = blkid_probe_get_buffer(pr,
-                       off + (cat_block * blocksize), 0x2000);
+                       off + ((blkid_loff_t) cat_block * blocksize), 0x2000);
        if (!buf)
                return 0;
 
@@ -262,7 +262,9 @@ static int probe_hfsplus(blkid_probe pr, const struct blkid_idmag *mag)
 
        leaf_off = (ext_block_start + leaf_block) * blocksize;
 
-       buf = blkid_probe_get_buffer(pr, off + leaf_off, leaf_node_size);
+       buf = blkid_probe_get_buffer(pr,
+                               (blkid_loff_t) off + leaf_off,
+                               leaf_node_size);
        if (!buf)
                return 0;
 
index 78ddda684424d314c472ab338c350abc0ef6b1d0..766d6980fa55fa4f0d1f0b955737091ea43ea596 100644 (file)
@@ -55,7 +55,7 @@ struct volume_structure_descriptor {
        uint8_t         version;
 } __attribute__((packed));
 
-#define UDF_VSD_OFFSET                 0x8000
+#define UDF_VSD_OFFSET                 0x8000LL
 
 static int probe_udf(blkid_probe pr, const struct blkid_idmag *mag)
 {
@@ -86,7 +86,7 @@ nsr:
        for (b = 0; b < 64; b++) {
                vsd = (struct volume_structure_descriptor *)
                        blkid_probe_get_buffer(pr,
-                                       UDF_VSD_OFFSET + (b * bs),
+                                       UDF_VSD_OFFSET + ((blkid_loff_t) b * bs),
                                        sizeof(*vsd));
                if (!vsd)
                        return -1;
@@ -117,7 +117,9 @@ anchor:
        /* pick the primary descriptor from the list */
        for (b = 0; b < count; b++) {
                vd = (struct volume_descriptor *)
-                       blkid_probe_get_buffer(pr, (loc + b) * bs, sizeof(*vd));
+                       blkid_probe_get_buffer(pr,
+                                       (blkid_loff_t) (loc + b) * bs,
+                                       sizeof(*vd));
                if (!vd)
                        return -1;
 
index 60191b99e3a0c2d37e1476ea92f34c9175aba563..29c4da2a18e101b30fe42ff85bad2329c053e5eb 100644 (file)
@@ -132,7 +132,8 @@ static unsigned char *search_fat_label(blkid_probe pr,
                dir = (struct vfat_dir_entry *)
                        blkid_probe_get_buffer(pr,
                                        offset,
-                                       entries * sizeof(struct vfat_dir_entry));
+                                       (blkid_loff_t) entries *
+                                               sizeof(struct vfat_dir_entry));
                if (!dir)
                        return NULL;
        }
@@ -146,7 +147,8 @@ static unsigned char *search_fat_label(blkid_probe pr,
                if (!dir)
                        ent = (struct vfat_dir_entry *)
                                blkid_probe_get_buffer(pr,
-                                       offset + (i * sizeof(struct vfat_dir_entry)),
+                                       (blkid_loff_t) offset + (i *
+                                               sizeof(struct vfat_dir_entry)),
                                        sizeof(struct vfat_dir_entry));
                else
                        ent = &dir[i];
@@ -373,7 +375,7 @@ static int probe_vfat(blkid_probe pr, const struct blkid_idmag *mag)
                        struct fat32_fsinfo *fsinfo;
 
                        buf = blkid_probe_get_buffer(pr,
-                                       fsinfo_sect * sector_size,
+                                       (blkid_loff_t) fsinfo_sect * sector_size,
                                        sizeof(struct fat32_fsinfo));
                        if (buf == NULL)
                                return -1;