From 92cdf49e287dfb483f046cae4edc2afa4ceecaab Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 18 Dec 2011 19:03:58 +0100 Subject: [PATCH] Clip flash read request to maximum flash size --- src/stlink-common.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.30.2