Some more safety measures with LangString

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1319 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-10-07 20:07:28 +00:00
parent 2f61bc023e
commit 1ffbd1351b

View file

@ -84,7 +84,20 @@ StringTable* CEXEBuild::GetTable(LANGID &lang) {
return 0;
}
memset(table, 0, sizeof(StringTable)-sizeof(GrowBuf)*2);
table->lang_id = table->lang_id = lang;
table->lang_id = lang;
int zero = 0;
// make sure all of the user's strings tables are the same size
for (int j = 0; j < string_tables.size(); j++) {
int i = build_userlangstrings.getnum();
i -= table->user_strings.getlen() / sizeof(int);
while (i--) table->user_strings.add(&zero, sizeof(int));
i = ubuild_userlangstrings.getnum();
i -= table->user_ustrings.getlen() / sizeof(int);
while (i--) table->user_ustrings.add(&zero, sizeof(int));
}
string_tables.push_back(table);
}