mirror of
https://github.com/fhgwright/SCSI2SD.git
synced 2025-04-10 01:37:07 +00:00
Fix crash when SD card is smaller than starting sector of scsi disk
This commit is contained in:
parent
124ccf1d64
commit
63ef5824b1
@ -28,7 +28,16 @@ uint32_t getScsiCapacity(
|
||||
uint32_t capacity =
|
||||
(sdDev.capacity - sdSectorStart) /
|
||||
SDSectorsPerSCSISector(bytesPerSector);
|
||||
if (scsiSectors && (capacity > scsiSectors))
|
||||
|
||||
if (sdDev.capacity == 0)
|
||||
{
|
||||
capacity = 0;
|
||||
}
|
||||
else if (sdSectorStart >= sdDev.capacity)
|
||||
{
|
||||
capacity = 0;
|
||||
}
|
||||
else if (scsiSectors && (capacity > scsiSectors))
|
||||
{
|
||||
capacity = scsiSectors;
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user