Skip to content

Commit

Permalink
Changes to use memmove for overlapping ranges #2807
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Feb 11, 2023
1 parent 7f94769 commit 5e223ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tsk/fs/fs_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
#include "tsk_fs_i.h"

#include <string.h>


/* File Walk Action to load the journal
* TSK_FS_LOAD_FILE is defined in fs_tools.h
Expand All @@ -32,7 +34,8 @@ tsk_fs_load_file_action(TSK_FS_FILE * fs_file, TSK_OFF_T a_off,
else
cp_size = size;

memcpy(buf1->cur, buf, cp_size);
// Must use memmove here since memory ranges can overlap.
memmove(buf1->cur, buf, cp_size);
buf1->left -= cp_size;
buf1->cur = (char *) ((uintptr_t) buf1->cur + cp_size);

Expand Down

0 comments on commit 5e223ba

Please sign in to comment.