From b6302c6e5155af097940c0043e1b7941c2c1fefe Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 25 Oct 2014 20:52:14 +0200 Subject: PRINCE: Fix potential out-of-bounds write (CID 1248504) There are kMaxTexts text slots, so kMaxTexts itself is not valid. --- engines/prince/prince.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/prince/prince.cpp') diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 29c434e9c9..17cef6327f 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -730,8 +730,8 @@ bool PrinceEngine::loadSample(uint32 sampleSlot, const Common::String &streamNam bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::String &streamName) { debugEngine("Loading wav %s slot %d", streamName.c_str(), slot); - if (slot > kMaxTexts) { - error("Text slot bigger than MAXTEXTS %d", kMaxTexts); + if (slot >= kMaxTexts) { + error("Text slot bigger than MAXTEXTS %d", kMaxTexts - 1); return false; } -- cgit v1.2.3