summaryrefslogtreecommitdiff
path: root/Source/Library/Common/String.class.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Library/Common/String.class.cpp')
-rw-r--r--Source/Library/Common/String.class.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp
index fe851bd..8e958e0 100644
--- a/Source/Library/Common/String.class.cpp
+++ b/Source/Library/Common/String.class.cpp
@@ -195,6 +195,7 @@ String String::substr(s32int start, s32int size) {
if (size == 0) return String();
if (start < 0) start = m_length - start;
if (size == -1) size = m_length - start;
+ if (start + size >= (int)m_length) size = m_length - start;
String ret;
ret.m_string = new WChar[size + 1];
ret.m_length = size;