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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 20 07:24:36 UTC 2018


 extensions/source/activex/SODispatchInterceptor.cxx |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 07a70e84f21ef2a69d8b7a69a1bd3844a0c362f5
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Oct 20 08:23:10 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Oct 20 09:24:13 2018 +0200

    tdf#120703 (PVS): compare BSTR to wchar_t[] directly
    
    V505 The 'alloca' function is used inside the loop. This can quickly overflow
         stack.
    
    Change-Id: I57773664000df0f5329f957674661a2313205223
    Reviewed-on: https://gerrit.libreoffice.org/62038
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/extensions/source/activex/SODispatchInterceptor.cxx b/extensions/source/activex/SODispatchInterceptor.cxx
index ed610c56da8f..8cfe36c9e981 100644
--- a/extensions/source/activex/SODispatchInterceptor.cxx
+++ b/extensions/source/activex/SODispatchInterceptor.cxx
@@ -76,8 +76,7 @@ STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL,
 
     if( aTargetUrl.vt != VT_BSTR  ) return E_FAIL;
 
-    USES_CONVERSION;
-    if( !strncmp( OLE2T( aTargetUrl.bstrVal ), ".uno:OpenHyperlink", 18 ) )
+    if (!wcsncmp(aTargetUrl.bstrVal, L".uno:OpenHyperlink", 18))
     {
         CComQIPtr< IDispatch, &IID_IDispatch > pIDisp( this );
         if( pIDisp )
@@ -167,8 +166,7 @@ STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR
     if( pValue.vt != VT_BSTR || pValue.bstrVal == nullptr )
         return E_FAIL;
 
-    USES_CONVERSION;
-    if( !strncmp( OLE2T( pValue.bstrVal ), ".uno:OpenHyperlink", 18 ) )
+    if (!wcsncmp(pValue.bstrVal, L".uno:OpenHyperlink", 18))
     {
         long nLB = 0, nUB = 0;
         // long nDim = SafeArrayGetDim( aArgs );
@@ -193,7 +191,7 @@ STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR
 
                 if( pValues[0].vt == VT_BSTR && pValues[1].vt == VT_BSTR )
                 {
-                    if( !strncmp( OLE2T( pValues[0].bstrVal ), "URL", 3 ) )
+                    if (!wcsncmp(pValues[0].bstrVal, L"URL", 3))
                     {
                         EnterCriticalSection( &mMutex );
                         if( m_xParentControl )


More information about the Libreoffice-commits mailing list