Skip to content

Conversation

@legoabram
Copy link
Contributor

It's possible for uart_buf_ctr to decrement after checking it due to TX interrupts. This can cause the unsigned packet length to overflow when subtracted by 4, which makes memcpy and crc16_ansi overflow the UART buffer. The counter is just loaded into a local variable to prevent further modification.

Partially fixes #91088

It's possible for uart_buf_ctr to decrement after checking it due to TX
interrupts. This can cause the unsigned packet length to overflow when
subtracted by 4, which makes memcpy and crc16_ansi overflow the UART
buffer. The counter is just loaded into a local variable to prevent
further modification.

Partially fixes zephyrproject-rtos#91088

Signed-off-by: Abram Early <[email protected]>
@legoabram legoabram force-pushed the abram/modbus-overflow-fix branch from 9e2a5c9 to c936ac4 Compare December 4, 2025 22:25
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

modbus: Race condition on uart_buf_ctr corrupting RAM

3 participants