[rtems commit] dosfs: Unintentional integer overflow
Gedare Bloom
gedare at rtems.org
Thu Sep 5 19:07:52 UTC 2013
Module: rtems
Branch: master
Commit: 551468c2db505562ea06e0f8e576df86e178a68f
Changeset: http://git.rtems.org/rtems/commit/?id=551468c2db505562ea06e0f8e576df86e178a68f
Author: Gedare Bloom <gedare at rtems.org>
Date: Thu Sep 5 12:58:34 2013 -0400
dosfs: Unintentional integer overflow
Explicitly promote 32-bit integer to 64-bits for multiplication.
---
cpukit/libfs/src/dosfs/msdos_format.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cpukit/libfs/src/dosfs/msdos_format.c b/cpukit/libfs/src/dosfs/msdos_format.c
index a939df5..154282f 100644
--- a/cpukit/libfs/src/dosfs/msdos_format.c
+++ b/cpukit/libfs/src/dosfs/msdos_format.c
@@ -515,7 +515,7 @@ static int msdos_format_determine_fmt_params
ret_val = rtems_disk_fd_get_block_count(fd, &fmt_params->totl_sector_cnt);
}
if (ret_val == 0) {
- total_size = fmt_params->bytes_per_sector * fmt_params->totl_sector_cnt;
+ total_size = (uint64_t)fmt_params->bytes_per_sector * fmt_params->totl_sector_cnt;
msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_DETAIL,
"bytes per sector: %" PRIu32 "\ntotal sectors: %" PRIu32 "\ntotal size: %" PRIu64 "\n",
fmt_params->bytes_per_sector, fmt_params->totl_sector_cnt, total_size);
More information about the vc
mailing list