aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-12-04 14:56:06 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-12-04 14:56:06 +0000
commit73ac3b8e264df144a14084f633841bb314ae9294 (patch)
tree4b1af2c9b9d461b761fbf919d65ed3fe7fe492fe /src
parentMerge pull request #1372 (diff)
downloadmonero-73ac3b8e264df144a14084f633841bb314ae9294.tar.xz
wallet2: avoid possible undefined behavior on empty string
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 ea3994435..f637c8b03 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))};
}