diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-12-04 22:28:48 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-12-04 22:28:48 +0200 |
commit | b500a64524893379579c50f431bc9289f4ec0f48 (patch) | |
tree | d261272a43b02c3c568a397f6b5e80479ce7ceba | |
parent | Merge pull request #1398 (diff) | |
parent | wallet2: avoid possible undefined behavior on empty string (diff) | |
download | monero-b500a64524893379579c50f431bc9289f4ec0f48.tar.xz |
Merge pull request #1399
73ac3b8e wallet2: avoid possible undefined behavior on empty string (moneromooo-monero)
-rw-r--r-- | src/wallet/wallet2.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index f34bb59e9..2d293d45c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -191,8 +191,7 @@ boost::optional<tools::password_container> get_password(const boost::program_opt } // Remove line breaks the user might have inserted - password.erase(std::remove(password.end() - 1, password.end(), '\n'), password.end()); - password.erase(std::remove(password.end() - 1, password.end(), '\r'), password.end()); + boost::trim_right_if(password, boost::is_any_of("\r\n")); return {tools::password_container(std::move(password))}; } |