summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2012-07-17 10:32:07 -0700
committerNick Kralevich <nnk@google.com>2012-07-17 10:34:15 -0700
commit9acc2486787ee83b436b2999cd27f7b1ffb9fd69 (patch)
tree4b1f2d5ce418a4517eafe79ea56ca69bd08ffec4 /src
parent2e2afadd535ad3a92246fd3482f39a9174d814e9 (diff)
downloadexternal_libnfc-nxp-9acc2486787ee83b436b2999cd27f7b1ffb9fd69.zip
external_libnfc-nxp-9acc2486787ee83b436b2999cd27f7b1ffb9fd69.tar.gz
external_libnfc-nxp-9acc2486787ee83b436b2999cd27f7b1ffb9fd69.tar.bz2
phHal4Nfc_ADD: fix memcpy overlap
Don't call memcpy when src==dest. It's undefined. When memcpy overlap detection is enabled, this causes the NFC process to crash and burn. Bug: 6826770 Change-Id: I199af98e453953de288964f47248cb59af4deecb
Diffstat (limited to 'src')
-rw-r--r--src/phHal4Nfc_ADD.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/phHal4Nfc_ADD.c b/src/phHal4Nfc_ADD.c
index 0a3303c..727b7c4 100644
--- a/src/phHal4Nfc_ADD.c
+++ b/src/phHal4Nfc_ADD.c
@@ -671,11 +671,14 @@ void phHal4Nfc_TargetDiscoveryComplete(
if(phHal_eNfcIP1_Target ==
Hal4Ctxt->rem_dev_list[Count-1]->RemDevType)
{
- (void)memcpy(
- (void *)Hal4Ctxt->rem_dev_list[0],
- (void *)Hal4Ctxt->rem_dev_list[Count-1],
- sizeof(phHal_sRemoteDevInformation_t)
- );
+ if (Count != 1)
+ {
+ (void)memcpy(
+ (void *)Hal4Ctxt->rem_dev_list[0],
+ (void *)Hal4Ctxt->rem_dev_list[Count-1],
+ sizeof(phHal_sRemoteDevInformation_t)
+ );
+ }
NfcIpDeviceCount = 1;
break;
}