Out of bounds read in hal_core_initialized
Bug: 176446340
Test: build and run
Change-Id: I02f93750e590b2384f79580dd7c06fc06f46a4ca
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index fcdcbbc..a1e50f0 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -38,7 +38,7 @@
::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, ©[0]);