diff options
author | Andras Timar <atimar@suse.com> | 2011-10-28 15:52:42 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2011-10-28 15:55:09 +0200 |
commit | e1ef3ad57dfa59c3c97e811f76351f7982f77020 (patch) | |
tree | 8cd3b66127d1d084ad99a363c4ac56cb0dea31b3 /l10ntools | |
parent | 68c6af8de59a265f695793a5820579a18e4255f7 (diff) |
char array should be null terminated
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index e30a3e10648c..b158b3544055 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -532,15 +532,16 @@ void XRMResExport::WorkOnDesc( ByteString sDescFileName( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); sDescFileName.SearchAndReplaceAll( "description.xml", "" ); sDescFileName += GetAttribute( rOpenTag, "xlink:href" ); - ifstream::pos_type size; + int size; char * memblock; ifstream file (sDescFileName.GetBuffer(), ios::in|ios::binary|ios::ate); if (file.is_open()) { - size = file.tellg(); - memblock = new char [size]; + size = static_cast<int>(file.tellg()); + memblock = new char [size+1]; file.seekg (0, ios::beg); file.read (memblock, size); file.close(); + memblock[size] = '\0'; rText = ByteString(memblock); rText.SearchAndReplaceAll( "\n", "\\n" ); delete[] memblock; |