diff options
author | Max Horn | 2006-04-16 09:12:27 +0000 |
---|---|---|
committer | Max Horn | 2006-04-16 09:12:27 +0000 |
commit | 1f07432927838fcc09e39e8f89aad11ea2d90a76 (patch) | |
tree | dd18bdcc0b9c301cc88d473552e4c7ec847d2889 | |
parent | 58bfa30c7baedde26e0b1901c4dce3f0229b866b (diff) | |
download | scummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.tar.gz scummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.tar.bz2 scummvm-rg350-1f07432927838fcc09e39e8f89aad11ea2d90a76.zip |
Fixed evil longstanding bug in String::toLowercase & toUppercase: Before modifying the string content, make sure we do not share it with any other string). This should help (hopefully fix) bug #1470892
svn-id: r21931
-rw-r--r-- | common/str.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index 05be3b9e6b..47dd6eef8c 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -216,6 +216,7 @@ void String::toLowercase() { if (_str == 0 || _len == 0) return; + ensureCapacity(_len, true); for (int i = 0; i < _len; ++i) _str[i] = tolower(_str[i]); } @@ -224,6 +225,7 @@ void String::toUppercase() { if (_str == 0 || _len == 0) return; + ensureCapacity(_len, true); for (int i = 0; i < _len; ++i) _str[i] = toupper(_str[i]); } |