From face9611093377e8502d91f2ff56f9319a56357c Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 30 Apr 2021 19:04:22 +0200 Subject: [PATCH] refactor: Use only one temporary buffer in CreateObfuscateKey --- src/dbwrapper.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index d7694108f5d..3a1086bf4c5 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -220,10 +220,9 @@ const unsigned int CDBWrapper::OBFUSCATE_KEY_NUM_BYTES = 8; */ std::vector CDBWrapper::CreateObfuscateKey() const { - unsigned char buff[OBFUSCATE_KEY_NUM_BYTES]; - GetRandBytes(buff, OBFUSCATE_KEY_NUM_BYTES); - return std::vector(&buff[0], &buff[OBFUSCATE_KEY_NUM_BYTES]); - + std::vector ret(OBFUSCATE_KEY_NUM_BYTES); + GetRandBytes(ret.data(), OBFUSCATE_KEY_NUM_BYTES); + return ret; } bool CDBWrapper::IsEmpty()