summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Ren <jack.ren@intel.com>2011-08-16 19:17:47 +0200
committerJack Ren <jack.ren@intel.com>2012-03-01 11:30:01 +0800
commitd5dae5f9ae4f79985a032d011b6b3d12749823cd (patch)
treed85d5e3e39a610bedf99b634c70671173e6b2515
parent593d6d4a79601c530825ce9a52fd3f4cf03e1b6f (diff)
downloadexternal_libnfc-nxp-d5dae5f9ae4f79985a032d011b6b3d12749823cd.zip
external_libnfc-nxp-d5dae5f9ae4f79985a032d011b6b3d12749823cd.tar.gz
external_libnfc-nxp-d5dae5f9ae4f79985a032d011b6b3d12749823cd.tar.bz2
Fix one coding error of using a temporary variable in the global structure NdefMap
In the following code: the local variable PacketDataLength is a local variable in stack, but used in the ndefMap which is a global structure. When the function phFriNfc_NdefMap_EraseNdef( ) returns, the PacketDataLength will be freed, too. If it is used later via the pointer in NdefMap, will cause some of potential issues. Fix it by re-define it as static. NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap) { NFCSTATUS status = NFCSTATUS_PENDING; static uint8_t PktData[3] = PH_FRINFC_NDEFMAP_EMPTY_NDEF_MSG; uint8_t MemOffset = PH_FRINFC_NDEFMAP_SEEK_BEGIN; uint32_t PacketDataLength = sizeof(PktData); ... /* Mifare card selected. Call Mifare Write */ status = phFriNfc_NdefMap_WrNdef( NdefMap, PktData, &PacketDataLength, MemOffset); break; ... } Change-Id: Iee278fe39749619aa44c620138eae85a46f6e4a5 Signed-off-by: Dejan REBRACA <dejanx.rebraca@intel.com> Signed-off-by: Ken Wahid <kenx.wahid@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
-rw-r--r--src/phFriNfc_NdefMap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/phFriNfc_NdefMap.c b/src/phFriNfc_NdefMap.c
index b25e9ec..bd82e7a 100644
--- a/src/phFriNfc_NdefMap.c
+++ b/src/phFriNfc_NdefMap.c
@@ -1171,7 +1171,7 @@ NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap)
static uint8_t PktData[3] = PH_FRINFC_NDEFMAP_EMPTY_NDEF_MSG;
uint8_t MemOffset = PH_FRINFC_NDEFMAP_SEEK_BEGIN;
- uint32_t PacketDataLength = sizeof(PktData);
+ static uint32_t PacketDataLength = sizeof(PktData);
if (NdefMap == NULL )
{