Merge pull request #207 from ChupathingyCE/upstream-fix/lastmpmp-buffer

lastmpmp.txt written from a buffer of the size written
This commit is contained in:
MrBruh committed 2026-10-09 18:46:28 +13:00
commit dfc6ac5f9f
1 file changed
+6 -1
+6 -1
View File
@@ -851,17 +851,22 @@ void saved_game_file_remember_last_used_multiplayer_map(
char const *map_name)
{
struct file_reference file;
/* port: the name in a buffer of the size written (callers' may be
smaller: the menus' map list's are 64 bytes), the rest zeros */
char name[MAXIMUM_FILENAME_LENGTH+1];
match_assert(
"c:\\halo\\SOURCE\\saved games\\saved_game_files.c",
1207,
map_name);
csmemset(name, 0, sizeof(name));
csstrncpy(name, map_name, sizeof(name) - 1);
if (file_reference_create_from_path(&file, "z:\\lastmpmp.txt", FALSE) &&
file_create(&file) &&
file_open(&file, FLAG(_permission_write_bit)))
{
if (!file_write(&file, MAXIMUM_FILENAME_LENGTH+1, map_name))
if (!file_write(&file, MAXIMUM_FILENAME_LENGTH+1, name))
{
error(_error_silent, "failed to write to '%s'", "z:\\lastmpmp.txt");
}