aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-02-14 01:12:35 +0000
committerMax Horn2004-02-14 01:12:35 +0000
commit1e18364e5c34f578eaea359e709160d708f79b52 (patch)
tree3c16b3394d2d19ce9c68342a129a5c9e9b1358b3
parent324ce1f4ef134934e308a492165cd0ded780ffb4 (diff)
downloadscummvm-rg350-1e18364e5c34f578eaea359e709160d708f79b52.tar.gz
scummvm-rg350-1e18364e5c34f578eaea359e709160d708f79b52.tar.bz2
scummvm-rg350-1e18364e5c34f578eaea359e709160d708f79b52.zip
Fix for bug #896506 (GUI: Invalid read)
svn-id: r12864
-rw-r--r--common/str.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 2a9d728925..7ead1ddf21 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -172,8 +172,10 @@ void String::clear() {
}
void String::insertChar(char c, int p) {
+ // FIXME: This should be an 'assert', not an 'if' !
if (p >= 0 && p <= _len) {
- ensureCapacity(++_len, true);
+ ensureCapacity(_len + 1, true);
+ _len++;
for (int i = _len; i > p; i--) {
_str[i] = _str[i-1];
}