Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51d5b33d authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Treat empty/truncated GATT cache as error

Bug: 23054535
Change-Id: I6f60ff556204dabca91ce9075d5802d75fd35857
parent b82a3074
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ void bta_gattc_co_cache_load(BD_ADDR server_bda, UINT16 evt, UINT16 start_index,
    if (sCacheFD && (0 == fseek(sCacheFD, start_index * sizeof(tBTA_GATTC_NV_ATTR), SEEK_SET)))
    {
        num_attr = fread(attr, sizeof(tBTA_GATTC_NV_ATTR), BTA_GATTC_NV_LOAD_MAX, sCacheFD);
        if (start_index == 0 && num_attr < 1)
            status = BTA_GATT_ERROR; // Cache truncated
        else
            status = (num_attr < BTA_GATTC_NV_LOAD_MAX ? BTA_GATT_OK : BTA_GATT_MORE);
    }