Fixing a memory issue cuasing fuzzing crashes
Bug: 141331405
Test: Manually verifying the build with various NFC tags
Merged-In: I8070911c91ada3fbf73b59ca21740c71ae964453
Change-Id: I8070911c91ada3fbf73b59ca21740c71ae964453
diff --git a/src/nfc/tags/rw_t4t.cc b/src/nfc/tags/rw_t4t.cc
index 92ff5d9..b7b6144 100644
--- a/src/nfc/tags/rw_t4t.cc
+++ b/src/nfc/tags/rw_t4t.cc
@@ -2116,7 +2116,8 @@
status = false;
if (option == RW_T4T_CHK_EMPTY_I_BLOCK) {
/* use empty I block for presence check */
- p_data = (NFC_HDR*)GKI_getbuf(NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE);
+ p_data = (NFC_HDR*)GKI_getbuf(sizeof(NFC_HDR) + NCI_MSG_OFFSET_SIZE +
+ NCI_DATA_HDR_SIZE);
if (p_data != nullptr) {
p_data->offset = NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE;
p_data->len = 0;