Skip to content

Commit ac9547d

Browse files
committed
Make AI profile tables actually stop parsing if #End is missing.
By making parse_ai_profiles_tbl() actually check the return value of skip_to_start_of_string_either() (and break if the appropriate characters aren't found), AI profile tables should no longer keep parsing past the end of the file and into invalid memory, until they either find an "#End" in memory somewhere or just plain crash. As a pleasant bonus, a missing "#End" should now generate an appropriate error message.
1 parent cdeeee6 commit ac9547d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

code/ai/ai_profiles.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ void parse_ai_profiles_tbl(const char *filename)
498498
}
499499

500500
// find next valid option
501-
skip_to_start_of_string_either("$", "#");
501+
if (!skip_to_start_of_string_either("$", "#"))
502+
break;
502503
saved_Mp = Mp;
503504
}
504505
}

0 commit comments

Comments
 (0)