Fix GCC array bounds warning when accessing g_usrvars

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6258 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2012-09-06 22:43:31 +00:00
parent 667a2c8cae
commit c6fdb4436d
5 changed files with 18 additions and 8 deletions

View file

@ -2321,9 +2321,8 @@ int CEXEBuild::SetVarsSection()
VerifyDeclaredUserVarRefs(&m_UserVarNames);
int MaxUserVars = m_UserVarNames.getnum();
// -1 because the default size is 1
int stringSize = NSIS_MAX_STRLEN*(build_unicode?sizeof(TCHAR):sizeof(char));
if (!res_editor->AddExtraVirtualSize2PESection(NSIS_VARS_SECTION, (MaxUserVars - 1) * stringSize))
if (!res_editor->SetPESectionVirtualSize(NSIS_VARS_SECTION, MaxUserVars * stringSize))
{
ERROR_MSG(_T("Internal compiler error #12346: invalid exehead cannot find section \"%s\"!\n"), _T(NSIS_VARS_SECTION));
return PS_ERROR;