From 35f34f4d016cc693507e8036ceaf37c99db76837 Mon Sep 17 00:00:00 2001 From: Alisher Alikhodjaev Date: Thu, 15 Apr 2021 19:06:47 -0700 Subject: [PATCH] Out of bounds read in hal_core_initialized Bug: 176446340 Test: build and run Change-Id: I02f93750e590b2384f79580dd7c06fc06f46a4ca --- nfc/1.0/default/Nfc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp index fcdcbbc301..a1e50f059c 100644 --- a/nfc/1.0/default/Nfc.cpp +++ b/nfc/1.0/default/Nfc.cpp @@ -38,7 +38,7 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) {} ::android::hardware::Return Nfc::coreInitialized(const hidl_vec& data) { hidl_vec copy = data; - if (mDevice == nullptr) { + if (mDevice == nullptr || copy.size() == 0) { return NfcStatus::FAILED; } int ret = mDevice->core_initialized(mDevice, ©[0]);