1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Add room for the null byte at the end of the nonce2 string on stratum share submission and zero the allocated ram.

This commit is contained in:
Con Kolivas 2013-08-13 14:35:35 +10:00
parent 07adb98b34
commit 1d614599a7

View File

@ -5183,8 +5183,10 @@ static void *stratum_sthread(void *userdata)
* the 4 bytes so avoid potential overflow if a pool has set a * the 4 bytes so avoid potential overflow if a pool has set a
* large length by allocating the ram ourselves and using the * large length by allocating the ram ourselves and using the
* low level __bin2hex function. */ * low level __bin2hex function. */
work->nonce2_len += 1; /* Null byte */
align_len(&work->nonce2_len); align_len(&work->nonce2_len);
nonce2 = alloca(work->nonce2_len); nonce2 = alloca(work->nonce2_len);
memset(nonce2, 0, work->nonce2_len);
__bin2hex(nonce2, (const unsigned char *)&work->nonce2, sizeof(uint32_t)); __bin2hex(nonce2, (const unsigned char *)&work->nonce2, sizeof(uint32_t));
snprintf(s, sizeof(s), snprintf(s, sizeof(s),