Revert "OOBR in NxpMfcReader::SendIncDecRestoreCmdPart2"
This reverts commit b8417f0f7960f0289480eb417277e67101836278.
Reason for revert: May cause regressions with MIFARE functionality.
Change-Id: Ia80c33d758aeb13823312c80db7fd6aafc413d3b
diff --git a/SN100x/halimpl/mifare/NxpMfcReader.cc b/SN100x/halimpl/mifare/NxpMfcReader.cc
index c23bc6f..9df48da 100644
--- a/SN100x/halimpl/mifare/NxpMfcReader.cc
+++ b/SN100x/halimpl/mifare/NxpMfcReader.cc
@@ -55,7 +55,7 @@
/* send TAG_CMD part 2 for Mifare increment ,decrement and restore commands */
if (mfcTagCmdBuff[4] == eMifareDec || mfcTagCmdBuff[4] == eMifareInc ||
mfcTagCmdBuff[4] == eMifareRestore) {
- SendIncDecRestoreCmdPart2(mfcDataLen, pMfcData);
+ SendIncDecRestoreCmdPart2(pMfcData);
}
return writtenDataLen;
}
@@ -259,20 +259,14 @@
** Returns None
**
*******************************************************************************/
-void NxpMfcReader::SendIncDecRestoreCmdPart2(uint16_t mfcDataLen,
- const uint8_t *mfcData) {
+void NxpMfcReader::SendIncDecRestoreCmdPart2(const uint8_t *mfcData) {
NFCSTATUS status = NFCSTATUS_SUCCESS;
/* Build TAG_CMD part 2 for Mifare increment ,decrement and restore commands*/
uint8_t incDecRestorePart2[] = {0x00, 0x00, 0x05, (uint8_t)eMfRawDataXchgHdr,
0x00, 0x00, 0x00, 0x00};
uint8_t incDecRestorePart2Size =
(sizeof(incDecRestorePart2) / sizeof(incDecRestorePart2[0]));
-
if (mfcData[3] == eMifareInc || mfcData[3] == eMifareDec) {
- if (incDecRestorePart2Size >= mfcDataLen) {
- incDecRestorePart2Size = mfcDataLen - 1;
- android_errorWriteLog(0x534e4554, "238177877");
- }
for (int i = 4; i < incDecRestorePart2Size; i++) {
incDecRestorePart2[i] = mfcData[i + 1];
}
diff --git a/SN100x/halimpl/mifare/NxpMfcReader.h b/SN100x/halimpl/mifare/NxpMfcReader.h
index 14e1575..3b353ba 100644
--- a/SN100x/halimpl/mifare/NxpMfcReader.h
+++ b/SN100x/halimpl/mifare/NxpMfcReader.h
@@ -109,7 +109,7 @@
void BuildIncDecCmd();
void CalcSectorAddress();
void AuthForWrite();
- void SendIncDecRestoreCmdPart2(uint16_t mfcDataLen, const uint8_t* mfcData);
+ void SendIncDecRestoreCmdPart2(const uint8_t *mfcData);
public:
int Write(uint16_t mfcDataLen, const uint8_t *pMfcData);
@@ -117,4 +117,4 @@
NFCSTATUS CheckMfcResponse(uint8_t *pTransceiveData,
uint16_t transceiveDataLen);
static NxpMfcReader &getInstance();
-};
+};
\ No newline at end of file
diff --git a/halimpl/mifare/NxpMfcReader.cc b/halimpl/mifare/NxpMfcReader.cc
index 53d61b5..315a803 100644
--- a/halimpl/mifare/NxpMfcReader.cc
+++ b/halimpl/mifare/NxpMfcReader.cc
@@ -55,7 +55,7 @@
/* send TAG_CMD part 2 for Mifare increment ,decrement and restore commands */
if (mfcTagCmdBuff[4] == eMifareDec || mfcTagCmdBuff[4] == eMifareInc ||
mfcTagCmdBuff[4] == eMifareRestore) {
- SendIncDecRestoreCmdPart2(mfcDataLen, pMfcData);
+ SendIncDecRestoreCmdPart2(pMfcData);
}
return writtenDataLen;
}
@@ -259,20 +259,14 @@
** Returns None
**
*******************************************************************************/
-void NxpMfcReader::SendIncDecRestoreCmdPart2(uint16_t mfcDataLen,
- const uint8_t *mfcData) {
+void NxpMfcReader::SendIncDecRestoreCmdPart2(const uint8_t *mfcData) {
NFCSTATUS status = NFCSTATUS_SUCCESS;
/* Build TAG_CMD part 2 for Mifare increment ,decrement and restore commands*/
uint8_t incDecRestorePart2[] = {0x00, 0x00, 0x05, (uint8_t)eMfRawDataXchgHdr,
0x00, 0x00, 0x00, 0x00};
uint8_t incDecRestorePart2Size =
(sizeof(incDecRestorePart2) / sizeof(incDecRestorePart2[0]));
-
if (mfcData[3] == eMifareInc || mfcData[3] == eMifareDec) {
- if (incDecRestorePart2Size >= mfcDataLen) {
- incDecRestorePart2Size = mfcDataLen - 1;
- android_errorWriteLog(0x534e4554, "238177877");
- }
for (int i = 4; i < incDecRestorePart2Size; i++) {
incDecRestorePart2[i] = mfcData[i + 1];
}
diff --git a/halimpl/mifare/NxpMfcReader.h b/halimpl/mifare/NxpMfcReader.h
index 29d40f2..da216e1 100644
--- a/halimpl/mifare/NxpMfcReader.h
+++ b/halimpl/mifare/NxpMfcReader.h
@@ -109,7 +109,7 @@
void BuildIncDecCmd();
void CalcSectorAddress();
void AuthForWrite();
- void SendIncDecRestoreCmdPart2(uint16_t mfcDataLen, const uint8_t* mfcData);
+ void SendIncDecRestoreCmdPart2(const uint8_t *mfcData);
public:
int Write(uint16_t mfcDataLen, const uint8_t *pMfcData);
@@ -117,4 +117,4 @@
NFCSTATUS CheckMfcResponse(uint8_t *pTransceiveData,
uint16_t transceiveDataLen);
static NxpMfcReader &getInstance();
-};
+};
\ No newline at end of file