From: Uwe Bonnes Date: Sun, 18 Dec 2011 18:03:58 +0000 (+0100) Subject: Clip flash read request to maximum flash size X-Git-Url: https://git.gag.com/?p=fw%2Fstlink;a=commitdiff_plain;h=92cdf49e287dfb483f046cae4edc2afa4ceecaab Clip flash read request to maximum flash size --- diff --git a/src/stlink-common.c b/src/stlink-common.c index 8493c4c..b49e21a 100644 --- a/src/stlink-common.c +++ b/src/stlink-common.c @@ -812,6 +812,9 @@ int stlink_fread(stlink_t* sl, const char* path, stm32_addr_t addr, size_t size) return -1; } + if (size > sl->flash_size) + size = sl->flash_size; + /* do the copy by 1k blocks */ for (off = 0; off < size; off += 1024) { size_t read_size = 1024;