From aff92ea4cd0db8c9beacebe60c9a7c598b1eb01d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 15 Jan 2012 21:02:02 +0200 Subject: SCI: Zero-terminate strings in SciString::fromString() --- engines/sci/engine/segment.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/sci/engine/segment.cpp') diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 73d81baf3a..fcf9774a08 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -294,11 +294,12 @@ void SciString::fromString(const Common::String &string) { if (_type != 3) error("SciString::fromString(): Array is not a string"); - if (string.size() > _size) - setSize(string.size()); + setSize(string.size() + 1); for (uint32 i = 0; i < string.size(); i++) _data[i] = string[i]; + + _data[string.size()] = 0; } SegmentRef StringTable::dereference(reg_t pointer) { -- cgit v1.2.3