mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
klondike - fix chipstats api stats buffer overrun with 16 chips
This commit is contained in:
parent
9b1ac1796f
commit
0fd939e714
@ -584,18 +584,24 @@ static struct api_data *klondike_api_stats(struct cgpu_info *klncgpu)
|
|||||||
root = api_add_int(root, buf, (int *)(&iFan), true);
|
root = api_add_int(root, buf, (int *)(&iFan), true);
|
||||||
|
|
||||||
if (klninfo->devinfo[dev].chipstats != NULL) {
|
if (klninfo->devinfo[dev].chipstats != NULL) {
|
||||||
char data[128];
|
char data[2048];
|
||||||
|
char one[32];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
sprintf(buf, "Nonces / Chip %d", dev);
|
sprintf(buf, "Nonces / Chip %d", dev);
|
||||||
for (n = 0; n < klninfo->status[dev].chipcount; n++)
|
data[0] = '\0';
|
||||||
sprintf(data+n*8, "%07d ", klninfo->devinfo[dev].chipstats[n]);
|
for (n = 0; n < klninfo->status[dev].chipcount; n++) {
|
||||||
data[127] = 0;
|
snprintf(one, sizeof(one), "%07d ", klninfo->devinfo[dev].chipstats[n]);
|
||||||
|
strcat(data, one);
|
||||||
|
}
|
||||||
root = api_add_string(root, buf, data, true);
|
root = api_add_string(root, buf, data, true);
|
||||||
|
|
||||||
sprintf(buf, "Errors / Chip %d", dev);
|
sprintf(buf, "Errors / Chip %d", dev);
|
||||||
for (n = 0; n < klninfo->status[dev].chipcount; n++)
|
data[0] = '\0';
|
||||||
sprintf(data+n*8, "%07d ", klninfo->devinfo[dev].chipstats[n + klninfo->status[dev].chipcount]);
|
for (n = 0; n < klninfo->status[dev].chipcount; n++) {
|
||||||
data[127] = 0;
|
snprintf(one, sizeof(one), "%07d ", klninfo->devinfo[dev].chipstats[n + klninfo->status[dev].chipcount]);
|
||||||
|
strcat(data, one);
|
||||||
|
}
|
||||||
root = api_add_string(root, buf, data, true);
|
root = api_add_string(root, buf, data, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user