sc/source/filter/lotus/lotform.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
New commits: commit fcb7a5c2781d7202f1a680ea4d6cc396ccc52262 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Sep 4 21:16:33 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Sep 5 11:38:44 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: Icd01771dfa1ae7db94851d888ae3ce657313c67a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121656 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 98a302ed4809..1f3d8463142d 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -619,16 +619,9 @@ void LotusToSc::Convert( std::unique_ptr<ScTokenArray>& rpErg, sal_Int32& rRest if( nStrLen ) { - std::unique_ptr<char[]> p(new (::std::nothrow) char[ nStrLen + 1 ]); - if (p) - { - aIn.ReadBytes(p.get(), nStrLen); - p[ nStrLen ] = 0x00; - - DoFunc( ocNoName, nCnt, p.get() ); - } - else - DoFunc( ocNoName, nCnt, nullptr ); + std::vector<char> aBuffer(nStrLen + 1); + aBuffer[aIn.ReadBytes(aBuffer.data(), nStrLen)] = 0; + DoFunc(ocNoName, nCnt, aBuffer.data()); } else DoFunc( ocNoName, nCnt, nullptr );