Out of bounds read in hal_core_initialized

Bug: 176446340
Test: build and run
Change-Id: I02f93750e590b2384f79580dd7c06fc06f46a4ca
This commit is contained in:
Alisher Alikhodjaev
2021-04-15 19:06:47 -07:00
parent 041e19dd25
commit 35f34f4d01

View File

@@ -38,7 +38,7 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) {}
::android::hardware::Return<NfcStatus> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
hidl_vec<uint8_t> copy = data;
if (mDevice == nullptr) {
if (mDevice == nullptr || copy.size() == 0) {
return NfcStatus::FAILED;
}
int ret = mDevice->core_initialized(mDevice, &copy[0]);