diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-28 09:15:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-28 14:01:47 +0100 |
commit | 4b6956ca146f25b746f63c176b377d3c15d204ff (patch) | |
tree | 0283216cf2bfc78cefa5d5a15eedbf302429ec6c /sc | |
parent | 89b77d414c2c45d2b013089ed2a2b5c7cc4f00ec (diff) |
ensure null terminator
LIBREOFFICE-WB8DT2Q9
Change-Id: I98529325bbd3ff475ba84b4991eb17240440df4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130668
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/lotus/op.cxx | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index c886ace340f1..b10ba5709198 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -588,14 +588,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; |