Browse Source

xfdump: defensive static checks to ensure dump location always fits

Yuri D'Elia 2 years ago
parent
commit
9d3b19b637
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Firmware/xflash_dump.cpp

+ 1 - 1
Firmware/xflash_dump.cpp

@@ -7,7 +7,6 @@
 #ifdef XFLASH_DUMP
 #include "xflash.h"
 
-
 bool xfdump_check_state()
 {
     uint32_t magic;
@@ -70,6 +69,7 @@ static void xfdump_dump_core(dump_header_t& hdr, uint32_t addr, uint8_t* buf, ui
     xflash_wait_busy();
 
     // write data
+    static_assert(sizeof(dump_t::data) < RAMEND, "dump area size insufficient");
     xflash_multipage_program(addr, buf, cnt);
 }