From e2041ab78b9d21c9bc0d8dabedb9e297125a5e97 Mon Sep 17 00:00:00 2001 From: mutatrum Date: Thu, 28 Nov 2024 02:09:37 +0100 Subject: [PATCH] Set proper size in hex2bin call (#471) Fixes #302 --- components/stratum/stratum_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/stratum/stratum_api.c b/components/stratum/stratum_api.c index 9ac7106..cbae182 100644 --- a/components/stratum/stratum_api.c +++ b/components/stratum/stratum_api.c @@ -235,7 +235,7 @@ void STRATUM_V1_parse(StratumApiV1Message * message, const char * stratum_json) } new_work->merkle_branches = malloc(HASH_SIZE * new_work->n_merkle_branches); for (size_t i = 0; i < new_work->n_merkle_branches; i++) { - hex2bin(cJSON_GetArrayItem(merkle_branch, i)->valuestring, new_work->merkle_branches + HASH_SIZE * i, HASH_SIZE * 2); + hex2bin(cJSON_GetArrayItem(merkle_branch, i)->valuestring, new_work->merkle_branches + HASH_SIZE * i, HASH_SIZE); } new_work->version = strtoul(cJSON_GetArrayItem(params, 5)->valuestring, NULL, 16);