[Scummvm-git-logs] scummvm master -> c168c85db5bc888b7d11591a9f00ba70009f718e

criezy criezy at scummvm.org
Sat Aug 21 22:39:25 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:
c168c85db5 PRINCE: Fix out of bound access when examining objects


Commit: c168c85db5bc888b7d11591a9f00ba70009f718e
    https://github.com/scummvm/scummvm/commit/c168c85db5bc888b7d11591a9f00ba70009f718e
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-08-21T23:36:50+01:00

Commit Message:
PRINCE: Fix out of bound access when examining objects

The bug was introduced in commit 9a09449e8 and was causing random
crashes.

Changed paths:
    engines/prince/script.cpp


diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index d7436f0b2a..de833a90e0 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1029,7 +1029,7 @@ void Interpreter::O_GETMOBTEXT() {
 	// different phrases separated by '\0' characters, followed by an ID.
 	// The examination text ends for a mob if the ID is 0xFF.
 	// Strings are properly extracted by the interpreter in that format.
-	memcpy((char *)_stringBuf, _vm->_mobList[mob]._examText.c_str(), 1023);
+	memcpy((char *)_stringBuf, _vm->_mobList[mob]._examText.c_str(), MIN<int>(_vm->_mobList[mob]._examText.size(), 1023));
 	_string = _stringBuf;
 }
 




More information about the Scummvm-git-logs mailing list