SCI: Fix out-of-bounds error in MT-32 patch reading in GM mode.

svn-id: r47662
This commit is contained in:
Walter van Niftrik 2010-01-29 01:09:41 +00:00
parent 981252b1fe
commit 5ffba8631d

View File

@ -659,10 +659,15 @@ void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
debugCN(kDebugLevelSound, "%s -> ", Mt32PresetTimbreMaps[number].name);
break;
case 2:
strncpy(name, (const char *)data + 0x1ec + number * 0xf6, 10);
name[10] = 0;
_patchMap[i] = lookupGmInstrument(name);
debugCN(kDebugLevelSound, "%s -> ", name);
if (number < memtimbres) {
strncpy(name, (const char *)data + 0x1ec + number * 0xf6, 10);
name[10] = 0;
_patchMap[i] = lookupGmInstrument(name);
debugCN(kDebugLevelSound, "%s -> ", name);
} else {
_patchMap[i] = 0xff;
debugCN(kDebugLevelSound, "[Invalid] -> ");
}
break;
case 3:
_patchMap[i] = getGmInstrument(Mt32RhythmTimbreMaps[number]);