mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-21 18:35:26 -04:00
[misc] fix division by zero if the sector size is misreported
* It looks like some disks may report a sector size of zero * Hopefully, this will address #352 (but some report about the detected sector size from people observing the crash would be nice)
This commit is contained in:
parent
270ad743ab
commit
60c66ef813
3 changed files with 14 additions and 7 deletions
|
@ -431,6 +431,8 @@ static BOOL FormatFAT32(DWORD DriveIndex)
|
|||
}
|
||||
memcpy(&dgDrive, &xdgDrive->Geometry, sizeof(dgDrive));
|
||||
}
|
||||
if (dgDrive.BytesPerSector < 512)
|
||||
dgDrive.BytesPerSector = 512;
|
||||
if (IS_ERROR(FormatStatus)) goto out;
|
||||
if (!DeviceIoControl (hLogicalVolume, IOCTL_DISK_GET_PARTITION_INFO, NULL, 0, &piDrive,
|
||||
sizeof(piDrive), &cbRet, NULL)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue