sc/source/filter/lotus/op.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
New commits: commit f0414eb277da77a519e367d9c688eaf19442c7a0 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 28 09:15:10 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Feb 28 12:49:38 2022 +0100 ensure null terminator LIBREOFFICE-WB8DT2Q9 Change-Id: I98529325bbd3ff475ba84b4991eb17240440df4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130646 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 14f4cf327ed8..f95bff7e18ce 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -591,14 +591,9 @@ void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLeng sal_uInt16 nSheetNum(0); rStream.ReadUInt16(nSheetNum); - ::std::vector<char> sSheetName; - sSheetName.reserve(nLength-4); - for (sal_uInt16 i = 4; i < nLength; ++i) - { - char c; - rStream.ReadChar( c ); - sSheetName.push_back(c); - } + const size_t nStrLen = nLength - 4; + std::vector<char> sSheetName(nStrLen + 1); + sSheetName[rStream.ReadBytes(sSheetName.data(), nStrLen)] = 0; if (!ValidTab(nSheetNum)) return;