Correct NCI command size
In the case of FW log enable/disable, the command had a wrong size
Bug: 153988298
Test: check command length
Change-Id: Iba4569e0d4739ad725976da080f6ab3f8a3ad7f2
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__);
}