Skip to content

Conversation

david-cermak
Copy link
Collaborator

Support for CSLIP netif IDF-4118

@david-cermak david-cermak self-assigned this Sep 19, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

int len = uart_read_bytes(modem->uart.uart_dev, modem->buffer, modem->buffer_len, 1 / portTICK_PERIOD_MS);

if (len > 0) {
modem->buffer[len] = '\0';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: UART RX Task Buffer Overflow Risk

In cslip_modem_uart_rx_task, writing modem->buffer[len] = '\0' can cause a buffer overflow. If uart_read_bytes returns modem->buffer_len bytes, this writes one byte past the allocated buffer boundary. Additionally, null-terminating SLIP-encoded binary data is generally not appropriate for this buffer.

Fix in Cursor Fix in Web

lwip_netif->output_ip6(lwip_netif, &p, NULL);
#else
lwip_netif->output(lwip_netif, &p, NULL);
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Stack Allocation Bypasses lwIP Memory Management

The pbuf struct is allocated on the stack and only partially initialized, bypassing lwIP's memory management. Critical fields like type, flags, and ref are left uninitialized. Passing this pbuf to lwip_netif->output functions may lead to undefined behavior or memory corruption.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant