Prevent active BLE operations with unencrypted MI-format beacons (#22453)

This commit is contained in:
Andy Knight 2024-11-26 10:28:55 +00:00 committed by GitHub
parent 155dea98cd
commit 2322646773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -792,7 +792,7 @@ int genericSensorReadFn(int slot, int force){
break;*/
case MI_LYWSD03MMC:
// don't read if key present and we've decoded at least one advert
if (MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND && !force) return -2;
if ((MIBLEsensors[slot].needkey == KEY_NOT_REQUIRED || MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND) && !force) return -2;
res = MI32Operation(slot, OP_READ_HT_LY, LYWSD03_Svc, nullptr, LYWSD03_BattNotifyChar);
break;
case MI_LYWSD02MMC:
@ -800,7 +800,7 @@ int genericSensorReadFn(int slot, int force){
break;
case MI_MHOC401:
// don't read if key present and we've decoded at least one advert
if (MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND && !force) return -2;
if ((MIBLEsensors[slot].needkey == KEY_NOT_REQUIRED || MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND) && !force) return -2;
res = MI32Operation(slot, OP_READ_HT_LY, MHOC401_Svc, nullptr, MHOC401_BattNotifyChar);
break;