A stack OOB write vuln of nxp nfc hal library

Bug: 169259605
Test: build ok
Change-Id: I5b99093abdee065eed161f3cda41847a35b13e6a
diff --git a/halimpl/mifare/NxpMfcReader.cc b/halimpl/mifare/NxpMfcReader.cc
index f4a1878..4b85955 100644
--- a/halimpl/mifare/NxpMfcReader.cc
+++ b/halimpl/mifare/NxpMfcReader.cc
@@ -15,6 +15,7 @@
  *  limitations under the License.
  *
  ******************************************************************************/
+#include <log/log.h>
 #include "NxpMfcReader.h"
 #include "phNxpNciHal.h"
 #include <phNfcCompId.h>
@@ -43,6 +44,10 @@
   uint16_t mfcTagCmdBuffLen = 0;
   uint8_t mfcTagCmdBuff[MAX_MFC_BUFF_SIZE] = {0};
 
+  if (mfcDataLen > MAX_MFC_BUFF_SIZE) {
+    android_errorWriteLog(0x534e4554, "169259605");
+    mfcDataLen = MAX_MFC_BUFF_SIZE;
+  }
   memcpy(mfcTagCmdBuff, pMfcData, mfcDataLen);
   if (mfcDataLen >= 3)
     mfcTagCmdBuffLen = mfcDataLen - NCI_HEADER_SIZE;