more bounds checks in network_receive_save_remove_flag (#25)

This commit is contained in:
Isaac0-dev 2024-05-06 17:49:47 +10:00 committed by GitHub
parent 0174cfa0fa
commit 933f0812a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -29,12 +29,12 @@ void network_receive_save_remove_flag(struct Packet* p) {
packet_read(p, &flagsToRemove, sizeof(u32));
packet_read(p, &backupSlot, sizeof(u8));
if (fileIndex >= NUM_SAVE_FILES) {
if (fileIndex < 0 || fileIndex >= NUM_SAVE_FILES) {
LOG_ERROR("Invalid fileIndex: %d", fileIndex);
return;
}
if (courseIndex >= COURSE_COUNT) {
if (courseIndex < -1 || courseIndex >= COURSE_COUNT) {
LOG_ERROR("Invalid courseIndex: %d", courseIndex);
return;
}