aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-12-04 22:28:48 +0200
committerRiccardo Spagni <ric@spagni.net>2016-12-04 22:28:48 +0200
commitb500a64524893379579c50f431bc9289f4ec0f48 (patch)
treed261272a43b02c3c568a397f6b5e80479ce7ceba /src/wallet/wallet2.cpp
parentMerge pull request #1398 (diff)
parentwallet2: avoid possible undefined behavior on empty string (diff)
downloadmonero-b500a64524893379579c50f431bc9289f4ec0f48.tar.xz
Merge pull request #1399
73ac3b8e wallet2: avoid possible undefined behavior on empty string (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp3
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))};
}