aboutsummaryrefslogtreecommitdiff
path: root/src
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
parentf2ea2afb772d4377450d2e79ebf44d1e1ffa3ec6 (diff)
parent73ac3b8e264df144a14084f633841bb314ae9294 (diff)
downloadmonzero-core-b500a64524893379579c50f431bc9289f4ec0f48.tar.gz
monzero-core-b500a64524893379579c50f431bc9289f4ec0f48.tar.xz
monzero-core-b500a64524893379579c50f431bc9289f4ec0f48.zip
Merge pull request #1399
73ac3b8e wallet2: avoid possible undefined behavior on empty string (moneromooo-monero)
Diffstat (limited to 'src')
-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))};
}