From f489a751b9d6faf21058df274d71be282e895e8d Mon Sep 17 00:00:00 2001
From: Michael Cook <michael@episci.com>
Date: Sat, 10 Oct 2020 10:40:26 -0400
Subject: [PATCH] Fix memcpy with overlapping memory

Found by valgrind.
---
 openair2/LAYER2/MAC/rar_tools_ue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c
index 3d3f5174e8..9af5baec39 100644
--- a/openair2/LAYER2/MAC/rar_tools_ue.c
+++ b/openair2/LAYER2/MAC/rar_tools_ue.c
@@ -132,7 +132,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
   }
 
   // move the selected RAR to the front of the RA_PDSCH buffer
-  memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
-  memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
+  memmove(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
+  memmove(selected_rar_buffer + 1, (uint8_t *) rar, 6);
   return ret;
 }
-- 
2.26.2