Skip to content

Commit 694d32d

Browse files
HedongGaohuojianchao
authored andcommitted
mm/iob: handle overlapping copyin buffers
iob_copyin_internal() used memcpy() for all copy operations. Sources inside the destination IOB can overlap the copied range and cause data corruption. Use memmove() so overlapping ranges are copied safely. Signed-off-by: gaohedong <gaohedong@xiaomi.com>
1 parent 96d90ee commit 694d32d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mm/iob/iob_copyin.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int iob_copyin_internal(FAR struct iob_s *iob, FAR const uint8_t *src,
163163

164164
/* Copy from the user buffer to the I/O buffer. */
165165

166-
memcpy(dest, src, ncopy);
166+
memmove(dest, src, ncopy);
167167
iobinfo("iob=%p Copy %u bytes new len=%u\n",
168168
iob, ncopy, iob->io_len);
169169

0 commit comments

Comments
 (0)