Skip to content

Commit

Permalink
Linux/MacOSX: Only load valid XML language files (Language.langid.xml…
Browse files Browse the repository at this point in the history
… format with langid one of the predefined language identifiers)
  • Loading branch information
idrassi committed Aug 25, 2024
1 parent 380ca35 commit d6f0250
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Main/Forms/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit d6f0250

Please sign in to comment.