summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/strbuf.hxx5
-rw-r--r--sal/inc/rtl/ustrbuf.hxx5
2 files changed, 6 insertions, 4 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 5efd0557430e..7a28298f4cea 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -229,11 +229,12 @@ public:
{
const int l = c.length();
rtl_String* buffer = NULL;
- rtl_string_new_WithLength( &buffer, l );
+ nCapacity = l + 16;
+ rtl_string_new_WithLength( &buffer, nCapacity );
char* end = c.addData( buffer->buffer );
+ *end = '\0';
buffer->length = end - buffer->buffer;
pData = buffer;
- nCapacity = l + 16;
}
#endif
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 06d906e864eb..5f133bfc9205 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -221,12 +221,13 @@ public:
{
const int l = c.length();
rtl_uString* buffer = NULL;
- rtl_uString_new_WithLength( &buffer, l ); // TODO this clears, not necessary
+ nCapacity = l + 16;
+ rtl_uString_new_WithLength( &buffer, nCapacity ); // TODO this clears, not necessary
sal_Unicode* end = c.addData( buffer->buffer );
+ *end = '\0';
buffer->length = end - buffer->buffer;
// TODO realloc in case buffer->length is noticeably smaller than l ?
pData = buffer;
- nCapacity = l + 16;
}
#endif
/** Assign to this a copy of value.