[Libreoffice-commits] core.git: sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 16:51:33 UTC 2019


 sw/source/filter/html/htmlreqifreader.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 36567d58115e21c111b45c011524ddbae540fd91
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 10 16:17:13 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 10 18:50:37 2019 +0200

    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 <noel.grandin at collabora.co.uk>

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<SotStorage>& 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);


More information about the Libreoffice-commits mailing list