summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-28 09:15:10 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2022-03-03 13:38:06 +0100
commitb9016fac29b894e48b5d4956da007661f66056d2 (patch)
tree2eba3f03ed72a32ac67974e6f1f9f90a898d5ba1 /sc
parent053413932fd798819242449602a08120b7936857 (diff)
ensure null terminator
LIBREOFFICE-WB8DT2Q9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130668 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins (cherry picked from commit 4b6956ca146f25b746f63c176b377d3c15d204ff) Change-Id: I98529325bbd3ff475ba84b4991eb17240440df4b
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/lotus/op.cxx11
1 files changed, 3 insertions, 8 deletions
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 7dec5cfbd0d1..d2510ff5d1ab 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -580,14 +580,9 @@ void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLeng
SCTAB nSheetNum = static_cast<SCTAB>(nDummy);
rContext.pDoc->MakeTable(nSheetNum);
- ::std::vector<sal_Char> sSheetName;
- sSheetName.reserve(nLength-4);
- for (sal_uInt16 i = 4; i < nLength; ++i)
- {
- sal_Char c;
- rStream.ReadChar( c );
- sSheetName.push_back(c);
- }
+ const size_t nStrLen = nLength - 4;
+ std::vector<sal_Char> sSheetName(nStrLen + 1);
+ sSheetName[rStream.ReadBytes(sSheetName.data(), nStrLen)] = 0;
if (!sSheetName.empty())
{