[Scummvm-git-logs] scummvm master -> 6de22f8d0164731ee3faab443492dd4ff650199e

criezy criezy at scummvm.org
Sun Apr 11 22:55:17 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6de22f8d01 AGS: Make sure old dialog scripts are null terminated


Commit: 6de22f8d0164731ee3faab443492dd4ff650199e
    https://github.com/scummvm/scummvm/commit/6de22f8d0164731ee3faab443492dd4ff650199e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-04-11T23:55:04+01:00

Commit Message:
AGS: Make sure old dialog scripts are null terminated

This fixes random overflow issues in old games. I had for
example the issue with King of Rock, a 2.6.0 game.

Changed paths:
    engines/ags/shared/game/main_game_file.cpp


diff --git a/engines/ags/shared/game/main_game_file.cpp b/engines/ags/shared/game/main_game_file.cpp
index 91ed488392..4e22f4046f 100644
--- a/engines/ags/shared/game/main_game_file.cpp
+++ b/engines/ags/shared/game/main_game_file.cpp
@@ -256,8 +256,9 @@ void ReadDialogs(DialogTopic *&dialog,
 			// Originally in the Editor +20000 bytes more were allocated, with comment:
 			//   "add a large buffer because it will get added to if another option is added"
 			// which probably refered to this data used by old editor directly to edit dialogs
-			char *buffer = new char[script_text_len];
+			char *buffer = new char[script_text_len + 1];
 			in->Read(buffer, script_text_len);
+			buffer[script_text_len] = 0;
 			if (data_ver > kGameVersion_260)
 				decrypt_text(buffer);
 			old_dialog_src[i] = buffer;




More information about the Scummvm-git-logs mailing list