This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 482be651ad533171c2659e2e0563dae5ff16a1e1
Author: gaohedong <[email protected]>
AuthorDate: Tue Nov 3 09:28:25 2026 +0800

    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 <[email protected]>
---
 mm/iob/iob_copyin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/iob/iob_copyin.c b/mm/iob/iob_copyin.c
index 0b5e79e0fc9..30d94aebac2 100644
--- a/mm/iob/iob_copyin.c
+++ b/mm/iob/iob_copyin.c
@@ -163,7 +163,7 @@ static int iob_copyin_internal(FAR struct iob_s *iob, FAR 
const uint8_t *src,
 
       /* Copy from the user buffer to the I/O buffer.  */
 
-      memcpy(dest, src, ncopy);
+      memmove(dest, src, ncopy);
       iobinfo("iob=%p Copy %u bytes new len=%u\n",
               iob, ncopy, iob->io_len);
 

Reply via email to