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:
parent
f2d8b4cc94
commit
3f0da93902
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue