Skip to content

Commit 53524d9

Browse files
authored
Tiny fix for tinyxml
1 parent c86f493 commit 53524d9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vendor/cegui-0.4.0-custom/src/tinyxml/tinystr.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,17 @@ void TiXmlString::append( const char* str, int len )
155155
new_string = new char [new_alloc];
156156
new_string [0] = 0;
157157

158+
// cache old length before possible delete
159+
unsigned old_length = length();
160+
158161
// copy the previous allocated buffer into this one
159162
if (allocated && cstring)
160163
// strcpy (new_string, cstring);
161-
memcpy (new_string, cstring, length ());
164+
memcpy (new_string, cstring, old_length);
162165

163166
// append the suffix. It does exist, otherwize we wouldn't be expanding
164167
// strncat (new_string, str, len);
165-
memcpy (new_string + length (),
168+
memcpy (new_string + old_length,
166169
str,
167170
size_suffix);
168171

0 commit comments

Comments
 (0)