summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Boie2011-11-14 23:16:16 -0600
committerAndrew Boie2012-07-26 12:18:14 -0500
commit0b344e7f111d845f9cbb8d284f62d546645c733e (patch)
tree9e3a3b11b0807bbd821f5b8a8af7fe2b0d81f72c /libdiskconfig/config_mbr.c
parent23ee469c4b790634959e5ccf83134f44e73fb72b (diff)
downloadplatform-system-core-0b344e7f111d845f9cbb8d284f62d546645c733e.tar.gz
platform-system-core-0b344e7f111d845f9cbb8d284f62d546645c733e.tar.xz
platform-system-core-0b344e7f111d845f9cbb8d284f62d546645c733e.zip
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 <andrew.p.boie@intel.com>
Diffstat (limited to 'libdiskconfig/config_mbr.c')
-rw-r--r--libdiskconfig/config_mbr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libdiskconfig/config_mbr.c b/libdiskconfig/config_mbr.c
index 703484c21..b89d382be 100644
--- a/libdiskconfig/config_mbr.c
+++ b/libdiskconfig/config_mbr.c
@@ -152,7 +152,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
152 152
153 /* we are going to write the ebr at the current LBA, and then bump the 153 /* we are going to write the ebr at the current LBA, and then bump the
154 * lba counter since that is where the logical data partition will start */ 154 * 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;
156 (*lba)++; 156 (*lba)++;
157 157
158 ebr = (struct pc_boot_record *) &item->data; 158 ebr = (struct pc_boot_record *) &item->data;