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 2014-05-21 17:39:49 +00:00
parent 92a68a8501
commit 12d9d80011
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",