mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 13:23:29 +01:00
wallet2: avoid possible undefined behavior on empty string
This commit is contained in:
parent
c36cb54340
commit
73ac3b8e26
@ -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))};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user