[Libreoffice-commits] .: Branch 'libreoffice-3-3' - 2 commits - desktop/win32
Tor Lillqvist
tml at kemper.freedesktop.org
Fri Jan 14 02:55:20 PST 2011
desktop/win32/source/setup/setup.cpp | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
New commits:
commit 4f81b94b7cee00c88e31612dc26800199c570ba6
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Fri Jan 14 12:23:56 2011 +0200
Be slightly more paranoid defensive
(cherry picked from commit f8bfab1f464d0f26accb6d28b31b4749306bbfda)
Signed-off-by: Thorsten Behrens <thb at documentfoundation.org>
diff --git a/desktop/win32/source/setup/setup.cpp b/desktop/win32/source/setup/setup.cpp
index 1746696..69d09a4 100644
--- a/desktop/win32/source/setup/setup.cpp
+++ b/desktop/win32/source/setup/setup.cpp
@@ -271,7 +271,7 @@ boolean SetupAppX::GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
DWORD nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
- while ( nRet && ( nRet + 2 == rSize ) ) // buffer was too small, retry until big enough
+ while ( nRet && ( nRet + 2 >= rSize ) ) // buffer was too small, retry until big enough
{
if (rSize > 1000000)
break;
@@ -291,7 +291,7 @@ boolean SetupAppX::GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
Log( sBuf );
return false;
}
- else if ( nRet + 2 == rSize )
+ else if ( nRet + 2 >= rSize )
{
SetError( ERROR_OUTOFMEMORY );
Log( TEXT( "ERROR: GetPrivateProfileSection() out of memory\r\n" ) );
commit c13ec5fbad1bbdc5a40a70b3d0b4ca86c01708fb
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Thu Jan 13 23:49:18 2011 +0200
Fix buffer size problem that broke MSI installer localization
(cherry picked from commit 5b7719a49fd57a9f446201fabc02bf1787dbbeee)
Signed-off-by: Thorsten Behrens <thb at documentfoundation.org>
diff --git a/desktop/win32/source/setup/setup.cpp b/desktop/win32/source/setup/setup.cpp
index 8bebaa2..1746696 100644
--- a/desktop/win32/source/setup/setup.cpp
+++ b/desktop/win32/source/setup/setup.cpp
@@ -265,22 +265,21 @@ boolean SetupAppX::GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
{
if ( !rSize || !*pRetBuf )
{
- rSize = 512;
+ rSize = 10000;
*pRetBuf = new TCHAR[ rSize ];
}
DWORD nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
- if ( nRet && ( nRet + 2 > rSize ) ) // buffer was too small, retry with bigger one
+ while ( nRet && ( nRet + 2 == rSize ) ) // buffer was too small, retry until big enough
{
- if ( nRet < 32767 - 2 )
- {
- delete [] (*pRetBuf);
- rSize = nRet + 2;
- *pRetBuf = new TCHAR[ rSize ];
+ if (rSize > 1000000)
+ break;
+ delete [] (*pRetBuf);
+ rSize = rSize * 2;
+ *pRetBuf = new TCHAR[ rSize ];
- nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
- }
+ nRet = GetPrivateProfileSection( pSection, *pRetBuf, rSize, pFileName );
}
if ( !nRet )
@@ -292,7 +291,7 @@ boolean SetupAppX::GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
Log( sBuf );
return false;
}
- else if ( nRet + 2 > rSize )
+ else if ( nRet + 2 == rSize )
{
SetError( ERROR_OUTOFMEMORY );
Log( TEXT( "ERROR: GetPrivateProfileSection() out of memory\r\n" ) );
More information about the Libreoffice-commits
mailing list