Add a test to avoid calling memcpy with identical source and destination addresses, which has undefined behavior and causes Valgrind to report an error. Signed-off-by: David Ward <david.ward at ll.mit.edu> --- .../WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c index b1b8140..ecd51b7 100644 --- a/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c +++ b/InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c @@ -3078,7 +3078,10 @@ void l4db_RemoveSpecialCharacters(char* string) (0 != OSAL_CAPI_strncmp(&currChar, "+", 1)) && (0 != OSAL_CAPI_strncmp(&currChar, " ", 1))) { - OSAL_memcpy_s(&string[currCharIndex], 1, &string[i], 1); + if (i > currCharIndex) + { + OSAL_memcpy_s(&string[currCharIndex], 1, &string[i], 1); + } currCharIndex++; } } -- 1.7.1