mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
subsys/modbus: Fix potential memory overwrite (coverity)
The size of ctx->rx_adu.data is not CONFIG_MODBUS_BUFFER_SIZE. Coverity flagged the potential overwrite so just use sizeof(). Fixes #33789 Fixes #33792 Fixes #33818 Signed-off-by: David Leach <david.leach@nxp.com>
This commit is contained in:
@@ -70,7 +70,7 @@ int modbus_raw_submit_rx(const int iface, const struct modbus_adu *adu)
|
||||
ctx->rx_adu.unit_id = adu->unit_id;
|
||||
ctx->rx_adu.fc = adu->fc;
|
||||
memcpy(ctx->rx_adu.data, adu->data,
|
||||
MIN(adu->length, CONFIG_MODBUS_BUFFER_SIZE));
|
||||
MIN(adu->length, sizeof(ctx->rx_adu.data)));
|
||||
k_work_submit(&ctx->server_work);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user