Fixed overlapping memcpy in emubd

Found by DanielLyubin
This commit is contained in:
Christopher Haster
2019-07-16 15:23:42 -05:00
parent 31e28fddb7
commit 4ec4425272

View File

@@ -215,7 +215,7 @@ int lfs_emubd_prog(const struct lfs_config *cfg, lfs_block_t block,
// update history and stats // update history and stats
if (block != emu->history.blocks[0]) { if (block != emu->history.blocks[0]) {
memcpy(&emu->history.blocks[1], &emu->history.blocks[0], memmove(&emu->history.blocks[1], &emu->history.blocks[0],
sizeof(emu->history) - sizeof(emu->history.blocks[0])); sizeof(emu->history) - sizeof(emu->history.blocks[0]));
emu->history.blocks[0] = block; emu->history.blocks[0] = block;
} }