[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - xmlhelp/source

Caolán McNamara caolanm at redhat.com
Mon Aug 11 03:43:40 PDT 2014


 xmlhelp/source/cxxhelp/provider/urlparameter.hxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 712a286d1d430f91148600b52b6fc3d03881cf78
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 11 11:27:53 2014 +0100

    Resolves: fdo#82025 use strlen instead of stored length byte
    
    Change-Id: I58cf2391d7bf2480cd12d2b1b4cf73f346f4f95f
    (cherry picked from commit ad40561d13e004ca4c532afb406675eea3c6a663)
    Reviewed-on: https://gerrit.libreoffice.org/10864
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
index ba8f29c..05bca6d 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx
@@ -43,7 +43,6 @@ namespace chelp {
         {
         }
 
-
         OUString getHash()
         {
             if( m_ptr )
@@ -88,11 +87,15 @@ namespace chelp {
             if( ! m_ptr )
                 return OUString();
 
-            sal_Int32 sizeOfTitle =
-                ( sal_Int32 ) m_ptr[  2 + m_ptr[0] +  ( sal_Int32 ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ] ];
-            return OUString( m_ptr + 3 + m_ptr[0] +  ( sal_Int32 ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ],
-                                  sizeOfTitle,
-                                  RTL_TEXTENCODING_UTF8 );
+            //fdo#82025 - use strlen instead of stored length byte to determine string len
+            //There is a one byte length field at m_ptr[2 + m_ptr[0] +  m_ptr[1
+            //+ m_ptr[0]]] but by default sal_Char is signed so anything larger
+            //than 127 defaults to a negative value, casting it would allow up
+            //to 255 but instead make use of the null termination to avoid
+            //running into a later problem with strings >= 255
+            const sal_Char* pTitle = m_ptr + 3 + m_ptr[0] +  ( sal_Int32 ) m_ptr[ 1+ ( sal_Int32 ) m_ptr[0] ];
+
+            return OUString(pTitle, rtl_str_getLength(pTitle), RTL_TEXTENCODING_UTF8);
         }
 
 


More information about the Libreoffice-commits mailing list