mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 08:55:22 +01:00
[modbus-text-sensor] fix potential buffer overflow (#6993)
This commit is contained in:
parent
c747d7d45d
commit
9c2af6318c
1 changed files with 1 additions and 1 deletions
|
@ -15,7 +15,7 @@ void ModbusTextSensor::parse_and_publish(const std::vector<uint8_t> &data) {
|
||||||
std::ostringstream output;
|
std::ostringstream output;
|
||||||
uint8_t items_left = this->response_bytes;
|
uint8_t items_left = this->response_bytes;
|
||||||
uint8_t index = this->offset;
|
uint8_t index = this->offset;
|
||||||
char buffer[4];
|
char buffer[5];
|
||||||
while ((items_left > 0) && index < data.size()) {
|
while ((items_left > 0) && index < data.size()) {
|
||||||
uint8_t b = data[index];
|
uint8_t b = data[index];
|
||||||
switch (this->encode_) {
|
switch (this->encode_) {
|
||||||
|
|
Loading…
Reference in a new issue