mirror of https://github.com/YosysHQ/icestorm.git
iceprog: When reading, don't write more bytes than requested
This commit is contained in:
parent
8413b2c689
commit
7b97eb4177
|
|
@ -742,7 +742,8 @@ int main(int argc, char **argv)
|
|||
for (int addr = 0; addr < read_size; addr += 256) {
|
||||
uint8_t buffer[256];
|
||||
flash_read(rw_offset + addr, buffer, 256);
|
||||
fwrite(buffer, 256, 1, f);
|
||||
fwrite(buffer, read_size - addr > 256 ? 256 :
|
||||
read_size - addr, 1, f);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue