From ace8a26bc141adaadf9305e55495bafcc107b5b8 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Tue, 24 Sep 2019 23:51:39 -0500 Subject: [PATCH] fix(crypto): fix crash in tests (#146) FIxed bug where an unallocated vector was being used. Changed to use fix array since the buffer was never dynamic. --- src/crypto/curve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/curve.cpp b/src/crypto/curve.cpp index 80baebff..8aa92ea5 100644 --- a/src/crypto/curve.cpp +++ b/src/crypto/curve.cpp @@ -11,6 +11,7 @@ #include #include +#include #include "interfaces/identities.hpp" #include "utils/crypto_helpers.h" @@ -71,8 +72,7 @@ bool Curve::Ecdsa::sign(const uint8_t* hash32, r, s); // Copy the big-endian bytes into and R and S element byte-buffers. - std::vector rsBuffer; - rsBuffer.reserve(HASH_64_BYTE_LEN); + std::array rsBuffer = {}; r.getBigEndianBytes(&rsBuffer[0]); s.getBigEndianBytes(&rsBuffer[HASH_32_BYTE_LEN]);