mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 22:14:36 +00:00
Cope with not finding nonces in avalon parsing gracefully by not overflowing buffers.
This commit is contained in:
parent
e9429f3886
commit
bb06c2f01b
@ -622,9 +622,6 @@ static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *i
|
|||||||
size_t i, spare = AVALON_READ_SIZE - *offset;
|
size_t i, spare = AVALON_READ_SIZE - *offset;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (spare > AVALON_READ_SIZE - 1)
|
|
||||||
spare = AVALON_READ_SIZE - 1;
|
|
||||||
|
|
||||||
for (i = 0; i <= spare; i++) {
|
for (i = 0; i <= spare; i++) {
|
||||||
struct avalon_result *ar;
|
struct avalon_result *ar;
|
||||||
struct work *work;
|
struct work *work;
|
||||||
@ -650,7 +647,10 @@ static void avalon_parse_results(struct cgpu_info *avalon, struct avalon_info *i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spare = AVALON_READ_SIZE + i;
|
if (!found)
|
||||||
|
spare = *offset - AVALON_READ_SIZE - 1;
|
||||||
|
else
|
||||||
|
spare = AVALON_READ_SIZE + i;
|
||||||
*offset -= spare;
|
*offset -= spare;
|
||||||
memmove(buf, buf + spare, *offset);
|
memmove(buf, buf + spare, *offset);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user