summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ward <david.ward@ll.mit.edu>2011-02-05 10:49:48 -0500
committerInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>2011-03-22 11:29:09 -0700
commitc24b146943c13a67b018c8297da11faaed1dfc04 (patch)
treea944b1632a71377412718a07a139e6ed204a9de3
parentbefcae11af55ab8987548a01344ee994a83964e6 (diff)
NDnS: Avoid calling memcpy with identical source and destination addresses
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@ll.mit.edu>
-rw-r--r--InfraStack/OSAgnostic/WiMax/Agents/NDnS/L4_db/NDnSAgent_DB_Common.c5
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++;
}
}