mirror of https://github.com/arendst/Tasmota.git
Merge pull request #11333 from pcdiem/dgr5
Range check item before storing in value array
This commit is contained in:
commit
bf3754d927
|
@ -344,18 +344,18 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de
|
||||||
value |= *message_ptr++ << 16;
|
value |= *message_ptr++ << 16;
|
||||||
value |= *message_ptr++ << 24;
|
value |= *message_ptr++ << 24;
|
||||||
#ifdef USE_DEVICE_GROUPS_SEND
|
#ifdef USE_DEVICE_GROUPS_SEND
|
||||||
device_group->values_32bit[item - DGR_ITEM_MAX_16BIT - 1] = (item == DGR_ITEM_POWER ? value & 0xffffff : value);
|
if (item < DGR_ITEM_LAST_32BIT) device_group->values_32bit[item - DGR_ITEM_MAX_16BIT - 1] = (item == DGR_ITEM_POWER ? value & 0xffffff : value);
|
||||||
#endif // USE_DEVICE_GROUPS_SEND
|
#endif // USE_DEVICE_GROUPS_SEND
|
||||||
}
|
}
|
||||||
#ifdef USE_DEVICE_GROUPS_SEND
|
#ifdef USE_DEVICE_GROUPS_SEND
|
||||||
else {
|
else {
|
||||||
device_group->values_16bit[item - DGR_ITEM_MAX_8BIT - 1] = value;
|
if (item < DGR_ITEM_LAST_16BIT) device_group->values_16bit[item - DGR_ITEM_MAX_8BIT - 1] = value;
|
||||||
}
|
}
|
||||||
#endif // USE_DEVICE_GROUPS_SEND
|
#endif // USE_DEVICE_GROUPS_SEND
|
||||||
}
|
}
|
||||||
#ifdef USE_DEVICE_GROUPS_SEND
|
#ifdef USE_DEVICE_GROUPS_SEND
|
||||||
else {
|
else {
|
||||||
device_group->values_8bit[item] = value;
|
if (item < DGR_ITEM_LAST_8BIT) device_group->values_8bit[item] = value;
|
||||||
}
|
}
|
||||||
#endif // USE_DEVICE_GROUPS_SEND
|
#endif // USE_DEVICE_GROUPS_SEND
|
||||||
log_length = snprintf(log_ptr, log_remaining, PSTR("%u"), value);
|
log_length = snprintf(log_ptr, log_remaining, PSTR("%u"), value);
|
||||||
|
|
Loading…
Reference in New Issue