Snap for 6416172 from 53fedaa8339733a2acc957e47f97a98f6ec1b202 to rvc-release
Change-Id: I97c0a8bde05b5f4281e1d9cff0c335bf7d6c845b
diff --git a/st21nfc/hal_wrapper.cc b/st21nfc/hal_wrapper.cc
index ba0e6cc..e6b7cd1 100644
--- a/st21nfc/hal_wrapper.cc
+++ b/st21nfc/hal_wrapper.cc
@@ -199,6 +199,7 @@
uint8_t coreInitCmd[] = {0x20, 0x01, 0x02, 0x00, 0x00};
uint8_t coreResetCmd[] = {0x20, 0x00, 0x01, 0x01};
unsigned long num = 0;
+ int nciPropEnableFwDbgTraces_size = sizeof(nciPropEnableFwDbgTraces);
switch (mHalWrapperState) {
case HAL_WRAPPER_STATE_CLOSED: // 0
@@ -389,10 +390,14 @@
memcpy(nciPropEnableFwDbgTraces, nciHeaderPropSetConfig, 9);
memcpy(&nciPropEnableFwDbgTraces[10], &p_data[8],
p_data[6] - 1);
+ if ((9 + p_data[6]) < sizeof(nciPropEnableFwDbgTraces)) {
+ nciPropEnableFwDbgTraces_size = 9 + p_data[6];
+ }
+
confNeeded = false;
if (!HalSendDownstream(mHalHandle, nciPropEnableFwDbgTraces,
- sizeof(nciPropEnableFwDbgTraces))) {
+ nciPropEnableFwDbgTraces_size)) {
STLOG_HAL_E("%s - SendDownstream failed", __func__);
}