Merge pull request #1399

73ac3b8e wallet2: avoid possible undefined behavior on empty string (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2016-12-04 22:28:48 +02:00
commit b500a64524
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -191,8 +191,7 @@ boost::optional<tools::password_container> get_password(const boost::program_opt
} }
// Remove line breaks the user might have inserted // Remove line breaks the user might have inserted
password.erase(std::remove(password.end() - 1, password.end(), '\n'), password.end()); boost::trim_right_if(password, boost::is_any_of("\r\n"));
password.erase(std::remove(password.end() - 1, password.end(), '\r'), password.end());
return {tools::password_container(std::move(password))}; return {tools::password_container(std::move(password))};
} }