Merge pull request #1515 from GriffinRichards/fix-saveblockchunk
Disallow negative sizes in SAVEBLOCK_CHUNK
This commit is contained in:
commit
b9f6dd128d
1 changed files with 6 additions and 5 deletions
|
@ -46,8 +46,9 @@ static u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location);
|
||||||
#define SAVEBLOCK_CHUNK(structure, chunkNum) \
|
#define SAVEBLOCK_CHUNK(structure, chunkNum) \
|
||||||
{ \
|
{ \
|
||||||
chunkNum * SECTOR_DATA_SIZE, \
|
chunkNum * SECTOR_DATA_SIZE, \
|
||||||
min(sizeof(structure) - chunkNum * SECTOR_DATA_SIZE, SECTOR_DATA_SIZE) \
|
sizeof(structure) >= chunkNum * SECTOR_DATA_SIZE ? \
|
||||||
} \
|
min(sizeof(structure) - chunkNum * SECTOR_DATA_SIZE, SECTOR_DATA_SIZE) : 0 \
|
||||||
|
}
|
||||||
|
|
||||||
static const struct SaveSectionOffsets sSaveSectionOffsets[] =
|
static const struct SaveSectionOffsets sSaveSectionOffsets[] =
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue