|
|
@ -1813,8 +1813,9 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg, |
|
|
|
strcpy(idstring, wb->idstring); |
|
|
|
strcpy(idstring, wb->idstring); |
|
|
|
ASPRINTF(&fname, "%s.sharelog", wb->logdir); |
|
|
|
ASPRINTF(&fname, "%s.sharelog", wb->logdir); |
|
|
|
/* Fix broken clients sending too many chars */ |
|
|
|
/* Fix broken clients sending too many chars */ |
|
|
|
if ((int)strlen(nonce2) > wb->enonce2varlen * 2) |
|
|
|
len = wb->enonce2varlen * 2; |
|
|
|
nonce2[wb->enonce2varlen * 2] = '\0'; |
|
|
|
if ((int)strlen(nonce2) > len) |
|
|
|
|
|
|
|
nonce2[len] = '\0'; |
|
|
|
sdiff = submission_diff(client, wb, nonce2, ntime32, nonce, hash); |
|
|
|
sdiff = submission_diff(client, wb, nonce2, ntime32, nonce, hash); |
|
|
|
bswap_256(sharehash, hash); |
|
|
|
bswap_256(sharehash, hash); |
|
|
|
__bin2hex(hexhash, sharehash, 32); |
|
|
|
__bin2hex(hexhash, sharehash, 32); |
|
|
@ -1824,7 +1825,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg, |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
json_set_string(json_msg, "reject-reason", SHARE_ERR(err)); |
|
|
|
goto out_unlock; |
|
|
|
goto out_unlock; |
|
|
|
} |
|
|
|
} |
|
|
|
if ((int)strlen(nonce2) < wb->enonce2varlen * 2) { |
|
|
|
if ((int)strlen(nonce2) < len) { |
|
|
|
err = SE_INVALID_NONCE2; |
|
|
|
err = SE_INVALID_NONCE2; |
|
|
|
*err_val = JSON_ERR(err); |
|
|
|
*err_val = JSON_ERR(err); |
|
|
|
goto out_unlock; |
|
|
|
goto out_unlock; |
|
|
|