diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-28 09:15:10 +0000 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2022-08-11 05:32:35 +0200 |
commit | a08bce2c755a08d16e43af5b71c4a08bd2b49848 (patch) | |
tree | b17a713c0e1160be802d97423837459c21d8da27 | |
parent | ofz#44991 keep within legal ArrowShape range (diff) | |
download | core-a08bce2c755a08d16e43af5b71c4a08bd2b49848.tar.gz core-a08bce2c755a08d16e43af5b71c4a08bd2b49848.zip |
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
(cherry picked from commit 4b6956ca146f25b746f63c176b377d3c15d204ff)
-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 ea34c537e970..c7eff5ead338 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -581,14 +581,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; |