summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2012-07-17 09:28:13 -0700
committerNick Kralevich <nnk@google.com>2012-07-17 09:59:19 -0700
commit2e2afadd535ad3a92246fd3482f39a9174d814e9 (patch)
tree84445dcb2f3f6b3e7f28ced7a8db7b10688d2af8
parent02637312a6c22755df2469fa1fa078a93db7ad7a (diff)
downloadexternal_libnfc-nxp-2e2afadd535ad3a92246fd3482f39a9174d814e9.zip
external_libnfc-nxp-2e2afadd535ad3a92246fd3482f39a9174d814e9.tar.gz
external_libnfc-nxp-2e2afadd535ad3a92246fd3482f39a9174d814e9.tar.bz2
phFriNfc_OvrHal: fix memcpy overlap
Don't use the API workaround when OvrHal->TranceiveInfo.sRecvData.buffer == pRecvdata->buffer. When memcpy overlap detection is enabled, this causes the NFC process to crash and burn. memcpy is undefined when src=dest. Bug: 6826770 Change-Id: Iebc8f82a4f86d560e764cef2229a7f86fa642783
-rw-r--r--src/phFriNfc_OvrHal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/phFriNfc_OvrHal.c b/src/phFriNfc_OvrHal.c
index 539210e..9efff94 100644
--- a/src/phFriNfc_OvrHal.c
+++ b/src/phFriNfc_OvrHal.c
@@ -323,7 +323,10 @@ static void phFriNfc_OvrHal_CB_Transceive(void *context,
if(NULL != pRecvdata && OvrHal->TranceiveInfo.sRecvData.buffer != NULL && pRecvdata->buffer != NULL)
{
/* Work-around for the NFCIP Tranceive API */
- memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
+ if (OvrHal->TranceiveInfo.sRecvData.buffer != pRecvdata->buffer)
+ {
+ memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
+ }
if (OvrHal->pndef_recv_length != NULL)
{
*OvrHal->pndef_recv_length = (uint16_t) pRecvdata->length;