From c0920e02248562354c2c53fcd91f6b972299d999 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 7 Dec 2007 23:39:19 +0000 Subject: don't use str functions with binary data, should fix bug #1845760 svn-id: r29752 --- engines/scumm/sound.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index c33f1130fd..6e68c8405f 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -1223,13 +1223,15 @@ int ScummEngine::readSoundResource(int type, int idx) { tmpsize = _fileHandle->readUint32BE(); // SDAT contains name of file we want - _fileHandle->read(buffer, tmpsize - 8); - // files seem to be 11 chars (8.3) unused space is replaced by spaces - *(strstr(buffer, " ")) = '\0'; - + _fileHandle->read(buffer, MIN(128, tmpsize - 8)); + // files seem to be 11 chars (8.3) + char *p = (char *)memchr(buffer, '.', 12); + if (!p) p = &buffer[8]; + strcpy(p, ".dmu"); debugC(DEBUG_SOUND, "FMUS file %s", buffer); - if (dmuFile.open(buffer) == false) { - error("Can't open music file %s*", buffer); + + if (!dmuFile.open(buffer)) { + error("Can't open music file %s", buffer); _res->roomoffs[type][idx] = (uint32)RES_INVALID_OFFSET; return 0; } -- cgit v1.2.3