Set proper size in hex2bin call (#471)

Fixes #302
This commit is contained in:
mutatrum 2024-11-28 02:09:37 +01:00 committed by GitHub
parent cccb43553d
commit e2041ab78b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);