use length rather than static 4 for hex2bin func of extranonce2_generate (#660)

This commit is contained in:
adammwest 2025-01-27 18:46:58 +01:00 committed by GitHub
parent 1db16a52e1
commit e7b037df10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,7 @@ char *extranonce_2_generate(uint32_t extranonce_2, uint32_t length)
char *extranonce_2_str = malloc(length * 2 + 1);
memset(extranonce_2_str, '0', length * 2);
extranonce_2_str[length * 2] = '\0';
bin2hex((uint8_t *)&extranonce_2, sizeof(extranonce_2), extranonce_2_str, length * 2 + 1);
bin2hex((uint8_t *)&extranonce_2, length, extranonce_2_str, length * 2 + 1);
if (length > 4)
{
extranonce_2_str[8] = '0';