Skip to content
Commit cd7a6a4d authored by Armin Brauns's avatar Armin Brauns Committed by Carles Cufí
Browse files

coredump: use memmove instead of memcpy



With CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM, buffer_output() is
called on the entire RAM memory area. This includes the stack for the
coredump thread, which is where tmp_buf is stored. Eventually, it will copy
(parts of) tmp_buf into tmp_buf itself, which invokes Undefined Behaviour
in memcpy():

> The memory areas must not overlap.  Use memmove(3) if the memory areas do
> overlap.
- memcpy(3)

With picolibc, this is detected in __memcpy_chk() and causes a fault in
__chk_fail().

Signed-off-by: default avatarArmin Brauns <armin.brauns@embedded-solutions.at>
parent 21a6d560
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment