vintlabs / fauxmoESP

Add voice control of your ESP32 and ESP8266 devices using Amazon Alexa
MIT License
383 stars 69 forks source link

crash when alexa tries to control an id which is bigger than _devices.size() #90

Closed pvint closed 3 years ago

pvint commented 5 years ago

Original report by Lucas Neumann (Bitbucket: fiakergulaschsaft, ).


Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads

this occurs in fauxmoESP::_onTCPControl if alexa tries to access a device with an ID which is higher than _devices.size() + 1.

so in line 218 in fauxmoESP.cpp change this:

if (id > 0) {

to this:

if (id > 0 && id <= _devices.size()) {

and all will be good.

stumbled across this as I'm currently working on a 868MHz RF gateway with nodes and nodes pairing/unpairing capability and alexa support for switch like (non sensor) nodes. for alexa support, i'm using fauxmo and as I'm constantly adding and removing nodes with alexa support, this issue came up.

pvint commented 3 years ago

Just looking at this and I was previously puzzled as to how this could happen, but I see it now.

I've added the change (Finally). Thanks!