diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/i18n.cpp | 14 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 3 | ||||
-rw-r--r-- | src/ringct/rctSigs.cpp | 1 | ||||
-rw-r--r-- | src/wallet/message_store.h | 1 |
4 files changed, 17 insertions, 2 deletions
diff --git a/src/common/i18n.cpp b/src/common/i18n.cpp index ffe8d8b52..a32875945 100644 --- a/src/common/i18n.cpp +++ b/src/common/i18n.cpp @@ -38,6 +38,8 @@ #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "i18n" +#define MAX_LANGUAGE_SIZE 16 + static const unsigned char qm_magic[16] = {0x3c, 0xb8, 0x64, 0x18, 0xca, 0xef, 0x9c, 0x95, 0xcd, 0x21, 0x1c, 0xbf, 0x60, 0xa1, 0xbd, 0xdd}; static std::map<std::string,std::string> i18n_entries; @@ -62,7 +64,19 @@ std::string i18n_get_language() std::string language = e; language = language.substr(0, language.find(".")); + language = language.substr(0, language.find("@")); + + // check valid values + for (char c: language) + if (!strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-.@", c)) + return "en"; + std::transform(language.begin(), language.end(), language.begin(), tolower); + if (language.size() > MAX_LANGUAGE_SIZE) + { + i18n_log("Language from LANG/LC_ALL suspiciously long, defaulting to en"); + return "en"; + } return language; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index d8163721e..a108124a8 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -173,7 +173,8 @@ Blockchain::Blockchain(tx_memory_pool& tx_pool) : //------------------------------------------------------------------ Blockchain::~Blockchain() { - deinit(); + try { deinit(); } + catch (const std::exception &e) { /* ignore */ } } //------------------------------------------------------------------ bool Blockchain::have_tx(const crypto::hash &id) const diff --git a/src/ringct/rctSigs.cpp b/src/ringct/rctSigs.cpp index 316f0e5e8..c5c6db3c1 100644 --- a/src/ringct/rctSigs.cpp +++ b/src/ringct/rctSigs.cpp @@ -871,7 +871,6 @@ namespace rct { sc_add(sumpouts.bytes, a[i].bytes, sumpouts.bytes); genC(pseudoOuts[i], a[i], inamounts[i]); } - rv.mixRing = mixRing; sc_sub(a[i].bytes, sumout.bytes, sumpouts.bytes); genC(pseudoOuts[i], a[i], inamounts[i]); DP(pseudoOuts[i]); diff --git a/src/wallet/message_store.h b/src/wallet/message_store.h index 7d26f7889..637bd29a1 100644 --- a/src/wallet/message_store.h +++ b/src/wallet/message_store.h @@ -135,6 +135,7 @@ namespace mms { monero_address_known = false; memset(&monero_address, 0, sizeof(cryptonote::account_public_address)); + me = false; index = 0; auto_config_public_key = crypto::null_pkey; auto_config_secret_key = crypto::null_skey; |