From 15691ad9150c8c6ea46e863cfb4ce6c0f658f111 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Sat, 9 Mar 2024 21:34:44 +0100 Subject: [PATCH] fix UB when reading key file --- src/Identity.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Identity.cpp b/src/Identity.cpp index 9f586439..b13328d3 100644 --- a/src/Identity.cpp +++ b/src/Identity.cpp @@ -14,6 +14,7 @@ Result 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(size)); key_file.close(); }