first buffer overflow

This commit is contained in:
Obe Van Lierde
2023-11-27 00:37:32 +01:00
parent 2b26c52ea6
commit 88c2d67d88

View File

@@ -62,7 +62,7 @@ static err_t modbus_incoming_data(void* arg, struct tcp_pcb* pcb, struct pbuf* p
tcp_recved(pcb, p->tot_len);
pc = (char*)p->payload;
for (uint16_t i = 0; i < MAX_REG; i++) { // Putting the buffer in the register array
for (uint16_t i = 0; i < p->tot_len && i < MAX_REG; i++) { // Putting the buffer in the register array
registers[i] = pc[i]; // Getting the error "void value not ignored as it ought to be" on this line
}