SCI: clear strcpy's dest string if src is invalid.

This fixes moving the plank at the start of KQ6 in Text mode.

svn-id: r44397
This commit is contained in:
Willem Jan Palenstijn 2009-09-27 13:05:50 +00:00
parent 77751a0455
commit 08e4d96a7d

View File

@ -912,6 +912,10 @@ void SegManager::strncpy(reg_t dest, reg_t src, size_t n) {
const SegmentRef src_r = dereference(src);
if (!src_r.isValid()) {
warning("Attempt to strncpy from invalid pointer %04x:%04x", PRINT_REG(src));
// Clear target string instead.
if (n > 0)
strcpy(dest, "");
return;
}