SCI: Fix more unsafe C-string usage

This commit is contained in:
Colin Snover
2017-02-05 12:38:21 -06:00
parent b1c3332fdd
commit 10d97ce379
14 changed files with 105 additions and 56 deletions
+6 -2
View File
@@ -598,8 +598,12 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
case SCI_OBJ_STRINGS:
debugN("Strings\n");
while (script->data [seeker]) {
debugN("%04x: %s\n", seeker, script->data + seeker);
seeker += strlen((char *)script->data + seeker) + 1;
debugN("%04x: %s", seeker, script->data + seeker);
seeker += Common::strnlen((char *)script->data + seeker, script->size - seeker) + 1;
if (seeker > script->size) {
debugN("[TRUNCATED]");
}
debugN("\n");
}
seeker++; // the ending zero byte
break;