diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-08-25 09:36:38 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-08-25 09:36:38 +0200 |
commit | d6f0250901b70892f121495ffbfbbc413791fd60 (patch) | |
tree | 5c122f135c07009db8d7bcad03e5d86dfc8b6063 | |
parent | 380ca35c6d34437380de252058bb68817c925810 (diff) | |
download | VeraCrypt-d6f0250901b70892f121495ffbfbbc413791fd60.tar.gz VeraCrypt-d6f0250901b70892f121495ffbfbbc413791fd60.zip |
Linux/MacOSX: Only load valid XML language files (Language.langid.xml format with langid one of the predefined language identifiers)
-rw-r--r-- | src/Main/Forms/PreferencesDialog.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp index a610987d..4e7644b6 100644 --- a/src/Main/Forms/PreferencesDialog.cpp +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -130,13 +130,22 @@ namespace VeraCrypt if (wxDir::Exists(languagesFolder.GetName())) { size_t langCount; - langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES); + langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, "*.xml", wxDIR_FILES); for (size_t i = 0; i < langCount; ++i) { wxFileName filename(langArray[i]); - wxString langId = filename.GetName().AfterLast('.'); - wxString langNative = langEntries[langId]; - if (!langNative.empty()) { - LanguageListBox->Append(langNative); + + // Get the name part of the file (without extension) + wxString basename = filename.GetName(); + + // Check if the basename matches the pattern "Language.langId" + if (basename.StartsWith("Language.")) { + wxString langId = basename.AfterFirst('.'); + + // Verify if the language ID exists in langEntries map + wxString langNative = langEntries[langId]; + if (!langNative.empty()) { + LanguageListBox->Append(langNative); + } } } } |