Skip to content

Commit 0b344e7

Browse files
author
Andrew Boie
committed
config_mbr: Fix integer overflow
The values need to be converted to loff_t *before* performing the multiplication, else any sector offset past MAX_INT bytes will overflow. Change-Id: Ib8992f28aa4119ac7b4ad354b2448c4b0cfaf846 Signed-off-by: Andrew Boie <[email protected]>
1 parent 23ee469 commit 0b344e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libdiskconfig/config_mbr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
152152

153153
/* we are going to write the ebr at the current LBA, and then bump the
154154
* lba counter since that is where the logical data partition will start */
155-
item->offset = (*lba) * dinfo->sect_size;
155+
item->offset = ((loff_t)(*lba)) * dinfo->sect_size;
156156
(*lba)++;
157157

158158
ebr = (struct pc_boot_record *) &item->data;

0 commit comments

Comments
 (0)