Skip to content

Commit

Permalink
fix(crypto): fix crash in tests (#146)
Browse files Browse the repository at this point in the history
FIxed bug where an unallocated vector was being used.
Changed to use fix array since the buffer was never dynamic.
  • Loading branch information
ciband authored and faustbrian committed Sep 25, 2019
1 parent 534f7f9 commit ace8a26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crypto/curve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <algorithm>
#include <vector>
#include <array>

#include "interfaces/identities.hpp"
#include "utils/crypto_helpers.h"
Expand Down Expand Up @@ -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<uint8_t> rsBuffer;
rsBuffer.reserve(HASH_64_BYTE_LEN);
std::array<uint8_t, HASH_64_BYTE_LEN> rsBuffer = {};
r.getBigEndianBytes(&rsBuffer[0]);
s.getBigEndianBytes(&rsBuffer[HASH_32_BYTE_LEN]);

Expand Down

0 comments on commit ace8a26

Please sign in to comment.