setup_native/source/win32/customactions/regactivex/regactivex.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
New commits: commit 1a471e674f46699a2787e3ab74353fbe1de5c456 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Apr 30 08:29:32 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Apr 30 11:08:26 2024 +0200 WaE: C6011 Dereferencing NULL pointer warnings from unchecked malloc Change-Id: I14892e3d0badb4a46b82624b86d78eb9bcb8eed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166700 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx index 48b11bd4f452..459887c3820b 100644 --- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -67,7 +67,7 @@ static void RegisterActiveXNative( const wchar_t* pActiveXPath, int nMode, bool if ( nLen > nRemoveLen ) { wchar_t* pProgramPath = static_cast<wchar_t*>( malloc( (nLen - nRemoveLen + 1) * sizeof(wchar_t) ) ); - assert(pProgramPath); // Don't handle OOM conditions + assert(pProgramPath && "Don't handle OOM conditions"); wcsncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen ); pProgramPath[ nLen - nRemoveLen ] = 0; @@ -104,7 +104,7 @@ static bool GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppV sz++; DWORD nbytes = sz * sizeof( wchar_t ); wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) ); - assert(buff); // Don't handle OOM conditions + assert(buff && "Don't handle OOM conditions"); ZeroMemory( buff, nbytes ); MsiGetPropertyW( hMSI, pPropName, buff, &sz ); *ppValue = buff; @@ -123,6 +123,7 @@ static bool GetActiveXControlPath( MSIHANDLE hMSI, wchar_t** ppActiveXPath ) { int nLen = wcslen( pProgPath ); *ppActiveXPath = static_cast<wchar_t*>( malloc( (nLen + 23) * sizeof(wchar_t) ) ); + assert(*ppActiveXPath && "Don't handle OOM conditions"); wcsncpy( *ppActiveXPath, pProgPath, nLen ); wcsncpy( (*ppActiveXPath) + nLen, L"program\so_activex.dll", 22 ); (*ppActiveXPath)[nLen+22] = 0;