diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-08-11 00:01:20 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-08-11 00:12:20 +0200 |
commit | 7d8cd0abb8e4b1b891e982d10f57de108aaca1ea (patch) | |
tree | 754d755a72c62cf1644cda1c5772ad6814774c0e /sw | |
parent | 1e0a822fa14eb4f8d3da80cf76dd5a43df472649 (diff) |
fdo#53328: sw: ascii import: fix crash:
The aWork buffer is missing space for the null terminator, which the
previous String::AllocateBuffer automatically added.
(regression from aac04652fda01b0299e17087b151f07d6115e894)
Change-Id: Ia12ad46dfb95dd59965a073debb95b241b2e97d9
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ascii/parasc.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/basflt/iodetect.cxx | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index ec68e011f138..4d53a8f40b01 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -331,7 +331,7 @@ sal_uLong SwASCIIParser::ReadChars() { sal_uInt32 nInfo; sal_Size nNewLen = lGCount, nCntBytes; - aWork.reset(new sal_Unicode[nNewLen]); + aWork.reset(new sal_Unicode[nNewLen + 1]); // add 1 for '\0' sal_Unicode* pBuf = aWork.get(); nNewLen = rtl_convertTextToUnicode( hConverter, hContext, diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 88c26d7ff43e..af3cd972e6ea 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -450,7 +450,7 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen, if (eCharSet != RTL_TEXTENCODING_DONTKNOW) { - boost::scoped_array<sal_Unicode> aWork(new sal_Unicode[rLen]); + boost::scoped_array<sal_Unicode> aWork(new sal_Unicode[rLen+1]); sal_Unicode *pNewBuf = aWork.get(); sal_Size nNewLen; if (eCharSet != RTL_TEXTENCODING_UCS2) |