Snap for 7316203 from eb815be25bcd6f28af539d91059649fe346f17d1 to rvc-platform-release

Change-Id: Iccdf3d659858e3234e571439bc24893f8fc4dfc5
diff --git a/1.2/StNfcService.cpp b/1.2/StNfcService.cpp
index a5b7b70..69f3dc1 100644
--- a/1.2/StNfcService.cpp
+++ b/1.2/StNfcService.cpp
@@ -53,7 +53,8 @@
       ALOGD("STReset Start");
       STEseReset fn = (STEseReset)dlsym(stdll, "boot_reset");
       if (fn) {
-        ALOGD("STReset Result=%d", fn());
+        int ret = fn();
+        ALOGD("STReset Result=%d", ret);
       }
     } else {
       ALOGE("%s not found, do nothing.", valueStr.c_str());
diff --git a/1.2/hal_st21nfc.cc b/1.2/hal_st21nfc.cc
index 9cbd19f..8397fe5 100644
--- a/1.2/hal_st21nfc.cc
+++ b/1.2/hal_st21nfc.cc
@@ -391,7 +391,8 @@
       STLOG_HAL_D("STReset Cold reset");
       STEseReset fn = (STEseReset)dlsym(stdll, "cold_reset");
       if (fn) {
-        STLOG_HAL_D("STReset Result=%d", fn());
+        int ret = fn();
+        STLOG_HAL_D("STReset Result=%d", ret);
       }
     } else {
       STLOG_HAL_D("%s not found, do nothing.", valueStr.c_str());
diff --git a/st21nfc/hal_wrapper.cc b/st21nfc/hal_wrapper.cc
index 4449d2d..f687189 100644
--- a/st21nfc/hal_wrapper.cc
+++ b/st21nfc/hal_wrapper.cc
@@ -20,6 +20,7 @@
 #include <cutils/properties.h>
 #include <errno.h>
 #include <hardware/nfc.h>
+#include <log/log.h>
 #include <string.h>
 #include <unistd.h>
 #include "android_logmsg.h"
@@ -386,6 +387,14 @@
                             __func__);
               }
 
+              if (data_len < 9 || p_data[6] == 0 || p_data[6] < (data_len - 7)
+                  || p_data[6] > (sizeof(nciPropEnableFwDbgTraces) - 9)) {
+                if (confNeeded) {
+                  android_errorWriteLog(0x534e4554, "169328517");
+                  confNeeded = false;
+                }
+              }
+
               if (confNeeded) {
                 memcpy(nciPropEnableFwDbgTraces, nciHeaderPropSetConfig, 9);
                 memcpy(&nciPropEnableFwDbgTraces[10], &p_data[8],