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

View file

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