Fix CID 1204379 (vtoc8.c) & CID 1204380 (bsd.c): Cast ncyls to lba_t

before multiplying the 32-bit integrals to avoid any possibility of
truncation before widening. Not a likely scenario to begin with...
This commit is contained in:
Marcel Moolenaar 2014-05-21 17:39:49 +00:00
parent adc991ea42
commit 762ff43901
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266514
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ bsd_write(lba_t imgsz, void *bootcode)
} else
memset(buf, 0, BBSIZE);
imgsz = ncyls * nheads * nsecs;
imgsz = (lba_t)ncyls * nheads * nsecs;
error = image_set_size(imgsz);
if (error) {
free(buf);

View File

@ -71,7 +71,7 @@ vtoc8_write(lba_t imgsz, void *bootcode __unused)
int error, n;
uint16_t ofs, sum;
imgsz = ncyls * nheads * nsecs;
imgsz = (lba_t)ncyls * nheads * nsecs;
memset(&vtoc8, 0, sizeof(vtoc8));
sprintf(vtoc8.ascii, "FreeBSD%lldM",