fix UB when reading key file

This commit is contained in:
Lion Kortlepel
2024-03-09 21:34:44 +01:00
parent ebdb94f362
commit 15691ad915

View File

@@ -14,6 +14,7 @@ Result<ident::Identity, std::string> ident::login_cached() noexcept {
std::ifstream key_file(ident::KEYFILE);
if (key_file.is_open()) {
auto size = fs::file_size(ident::KEYFILE);
private_key.resize(size);
key_file.read(&private_key[0], static_cast<long>(size));
key_file.close();
}