From 1ffbd1351b076f9980a4916b5f925007b74c7d4f Mon Sep 17 00:00:00 2001 From: kichik Date: Mon, 7 Oct 2002 20:07:28 +0000 Subject: [PATCH] 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 --- Source/lang.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/lang.cpp b/Source/lang.cpp index e07376a9..d5496262 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -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); }