aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorGregory Montoir2007-12-07 23:39:19 +0000
committerGregory Montoir2007-12-07 23:39:19 +0000
commitc0920e02248562354c2c53fcd91f6b972299d999 (patch)
tree0035ed30a3a79a56cd0ef0f2d3cdae39d4302475 /engines/scumm
parenta34df6e72d298ecccdaaf881809184fc4b3f0623 (diff)
downloadscummvm-rg350-c0920e02248562354c2c53fcd91f6b972299d999.tar.gz
scummvm-rg350-c0920e02248562354c2c53fcd91f6b972299d999.tar.bz2
scummvm-rg350-c0920e02248562354c2c53fcd91f6b972299d999.zip
don't use str functions with binary data, should fix bug #1845760
svn-id: r29752
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/sound.cpp14
1 files 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;
}