What changed, and why it matters
This change makes the Monero wallet command-line tool accept mnemonic seed language names regardless of capitalization (for example, 'English' vs 'english'). Previously, only exact-case matches were accepted, which could cause a user's language preference to be silently ignored and fall back to the default language. This is a minor usability fix with very limited security implications.
No security action required; treat as a routine usability improvement. Reviewers may optionally verify that canonical_mnemonic_language returns an empty string for unsupported languages so the existing fallback/prompt behavior is preserved.
Security signals we found
Case-insensitive input normalization for mnemonic language selection
No cryptographic, network, or privilege changes
No memory safety, buffer, or injection issues visible in diff
Evidence from the diff
The patch adds a case-insensitive helper, canonical_mnemonic_language(), that uses boost::algorithm::iequals to find the canonical language name from the supported list. It replaces exact-case std::find checks in two wallet-creation code paths. If the user-supplied –mnemonic-language value differed only in case, the old code would leave mnemonic_language empty and later prompt the user or fall back to the default. The new code accepts the value case-insensitively and stores the canonical list entry.
Changed components
src/simplewallet/simplewallet.cppCLI wallet mnemonic language handlingInspect captured patch +12 / −4
### src/simplewallet/simplewallet.cpp
@@ -4731,6 +4731,14 @@ bool simple_wallet::try_connect_to_daemon(bool silent, uint32_t* version)
return true;
}
+// Matches a mnemonic language name case-insensitively, returning the canonical list entry (empty if no match)
+static std::string canonical_mnemonic_language(const std::vector<std::string> &language_list, const std::string &name)
+{
+ const auto it = std::find_if(language_list.begin(), language_list.end(),
+ [&name](const std::string &language){ return boost::algorithm::iequals(language, name); });
+ return it == language_list.end() ? std::string() : *it;
+}
+
/*!
* \brief Gets the word seed language from the user.
*
@@ -4826,9 +4834,9 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
// Check for mnemonic language from command line argument
std::vector<std::string> language_list;
crypto::ElectrumWords::get_language_list(language_list, false, is_polyseed);
- if (mnemonic_language.empty() && std::find(language_list.begin(), language_list.end(), m_mnemonic_language) != language_list.end())
+ if (mnemonic_language.empty())
{
- mnemonic_language = m_mnemonic_language;
+ mnemonic_language = canonical_mnemonic_language(language_list, m_mnemonic_language);
}
// Ask for seed language if:
@@ -5031,9 +5039,9 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
std::vector<std::string> language_list;
crypto::ElectrumWords::get_language_list(language_list);
- if (mnemonic_language.empty() && std::find(language_list.begin(), language_list.end(), m_mnemonic_language) != language_list.end())
+ if (mnemonic_language.empty())
{
- mnemonic_language = m_mnemonic_language;
+ mnemonic_language = canonical_mnemonic_language(language_list, m_mnemonic_language);
}
m_wallet->set_seed_language(mnemonic_language);Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.