Some more memory allocation fixing
@@ -81,7 +81,7 @@ int sd_tournament_load(sd_tournament_file *trn, const char *filename) {
// Read enemy count and make sure it seems somwhat correct
int32_t enemy_count = sd_read_dword(r);
- if(enemy_count >= 256 || enemy_count < 0) {
+ if(enemy_count >= MAX_TRN_ENEMIES || enemy_count < 0) {
goto error_0;
}
@@ -98,7 +98,7 @@ int sd_tournament_load(sd_tournament_file *trn, const char *filename) {
// Read enemy block offsets
sd_reader_set(r, 300);
- int offset_list[256]; // Should be large enough
+ int offset_list[MAX_TRN_ENEMIES + 1]; // Should be large enough
memset(offset_list, 0, sizeof(offset_list));
for(int i = 0; i < trn->enemy_count + 1; i++) {
offset_list[i] = sd_read_dword(r);
