From 36567d58115e21c111b45c011524ddbae540fd91 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 10 Oct 2019 16:17:13 +0200 Subject: fix zero at end of string in ExtractOLEClassName this only worked by accident, because the only use of the string was to pass it to SvStream::WriteOString, which stops at the null byte Change-Id: Ief06db7b9c79943826da7bf377144e5244d328ee Reviewed-on: https://gerrit.libreoffice.org/80617 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/filter/html/htmlreqifreader.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/html/htmlreqifreader.cxx b/sw/source/filter/html/htmlreqifreader.cxx index f065528da3a5..a42bff8188d6 100644 --- a/sw/source/filter/html/htmlreqifreader.cxx +++ b/sw/source/filter/html/htmlreqifreader.cxx @@ -89,7 +89,7 @@ OString ExtractOLEClassName(const tools::SvRef& xStorage) return aRet; pCompObj->ReadUInt32(nData); // Reserved1 - return read_uInt8s_ToOString(*pCompObj, nData); + return read_uInt8s_ToOString(*pCompObj, nData - 1); // -1 because it is null-terminated } /// Parses the presentation stream of an OLE2 storage. @@ -162,7 +162,7 @@ OString InsertOLE1Header(SvStream& rOle2, SvStream& rOle1, sal_uInt32& nWidth, s rOle1.WriteUInt32(0x00000002); // ClassName - rOle1.WriteUInt32(aClassName.getLength()); + rOle1.WriteUInt32(aClassName.isEmpty() ? 0 : aClassName.getLength() + 1); if (!aClassName.isEmpty()) { rOle1.WriteOString(aClassName); -- cgit