Browse files

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 <>
  • Loading branch information...
1 parent 23ee469 commit 0b344e7f111d845f9cbb8d284f62d546645c733e @andrewboie andrewboie committed Nov 15, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 libdiskconfig/config_mbr.c
@@ -152,7 +152,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
/* we are going to write the ebr at the current LBA, and then bump the
* lba counter since that is where the logical data partition will start */
- item->offset = (*lba) * dinfo->sect_size;
+ item->offset = ((loff_t)(*lba)) * dinfo->sect_size;
ebr = (struct pc_boot_record *) &item->data;

0 comments on commit 0b344e7

Please sign in to comment.