aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/savegame.cpp
diff options
context:
space:
mode:
authorMax Horn2009-05-05 12:23:05 +0000
committerMax Horn2009-05-05 12:23:05 +0000
commit7e51eb647842e03326eb4b1d41401538f9903eb6 (patch)
tree1a288bac72f0e0dcd7da2acaa5d67ac99384493e /engines/sci/engine/savegame.cpp
parent29809407887bbc178a49f215e08f18918e41c4e7 (diff)
downloadscummvm-rg350-7e51eb647842e03326eb4b1d41401538f9903eb6.tar.gz
scummvm-rg350-7e51eb647842e03326eb4b1d41401538f9903eb6.tar.bz2
scummvm-rg350-7e51eb647842e03326eb4b1d41401538f9903eb6.zip
SCI: Actually, it turns out the SystemString is more messed up than I thought: In some places it allocates a memory block of max_size bytes; sometimes max_size+1 bytes; and sometimes max_size*sizeof(reg_t) bytes. And sometimes strings frags are accessed as plain C strings (e.g. when saved), sometimes as a string encode as a series of reg_t values. Ouch :/
svn-id: r40324
Diffstat (limited to 'engines/sci/engine/savegame.cpp')
-rw-r--r--engines/sci/engine/savegame.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 83cd125f11..a8f803c259 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -846,10 +846,10 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
// First, pad memory
for (int i = 0; i < SYS_STRINGS_MAX; i++) {
str = &retval->sys_strings->strings[i];
- char *data = (char *) str->value;
+ char *data = (char *)str->value;
if (data) {
- str->value = (reg_t *)sci_malloc(str->max_size + 1);
- strcpy((char *)str->value, data);
+ str->value = (reg_t *)calloc(str->max_size+1, sizeof(char)); // FIXME -- sizeof(char) or sizeof(reg_t) ??
+ strncpy((char *)str->value, data, str->max_size+1); // FIXME -- strncpy or internal_stringfrag_strncpy ?
free(data);
}
}