From 815ab2569f39e7e780b7f087ece1dd2fc8c9618f Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 25 Mar 2023 19:54:05 +0100 Subject: [PATCH] src/wif/k1.cpp: in _checksum_suffix() change array to std::vector as MSVC does not like variable size c-arrays. --- src/wif/k1.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wif/k1.cpp b/src/wif/k1.cpp index 507ce99..cb32283 100644 --- a/src/wif/k1.cpp +++ b/src/wif/k1.cpp @@ -23,6 +23,7 @@ */ #include +#include #include "codec.hpp" namespace libeosio { namespace internal { @@ -33,12 +34,12 @@ namespace libeosio { namespace internal { // // Should implement and use Init/Update/Finalize hash functions to do it inplace. checksum_t _checksum_suffix(const unsigned char *in, size_t size, const char *suffix) { - unsigned char buf[size + 2]; + std::vector buf(size + 2); - memcpy(buf, in, size); - memcpy(buf + size, suffix, 2); + memcpy(buf.data(), in, size); + memcpy(buf.data() + size, suffix, 2); - return checksum_ripemd160(buf, size + 2); + return checksum_ripemd160(buf.data(), buf.size()); } void pub_encoder_k1(const ec_pubkey_t& key, unsigned char *buf) {