diff options
Diffstat (limited to 'iceprog')
-rw-r--r-- | iceprog/iceprog.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c index e4e6f49..5233c46 100644 --- a/iceprog/iceprog.c +++ b/iceprog/iceprog.c @@ -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 |