PRINCE: Fix potential out-of-bounds write (CID 1248504)

There are kMaxTexts text slots, so kMaxTexts itself is not valid.
This commit is contained in:
Torbjörn Andersson 2014-10-25 20:52:14 +02:00
parent 9c885719fd
commit b6302c6e51

View File

@ -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;
}