Skip to content

Commit f000c11

Browse files
committed
Fix truncation check
1 parent 98cd162 commit f000c11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libogc/mmce.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static bool __mmce_readSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSect
513513
if (disc->ioType > DEVICE_TYPE_GAMECUBE_MMCE(2)) return false;
514514
if (!(disc->features & FEATURE_MEDIUM_CANREAD)) return false;
515515
if ((u32)sector != sector) return false;
516-
if ((u32)numSectors != numSectors) return false;
516+
if ((u16)numSectors != numSectors) return false;
517517
if (disc->bytesPerSector != 512) return false;
518518
if (!SYS_IsDMAAddress(buffer, 32)) return false;
519519
if (!__MMCE[chan].attached) return false;
@@ -529,7 +529,7 @@ static bool __mmce_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSec
529529
if (disc->ioType > DEVICE_TYPE_GAMECUBE_MMCE(2)) return false;
530530
if (!(disc->features & FEATURE_MEDIUM_CANWRITE)) return false;
531531
if ((u32)sector != sector) return false;
532-
if ((u32)numSectors != numSectors) return false;
532+
if ((u16)numSectors != numSectors) return false;
533533
if (disc->bytesPerSector != 512) return false;
534534
if (!SYS_IsDMAAddress(buffer, 32)) return false;
535535
if (!__MMCE[chan].attached) return false;

0 commit comments

Comments
 (0)