Skip to content

Conversation

@soopel
Copy link
Contributor

@soopel soopel commented Nov 14, 2025

  • Guarded udp_rx_dequeue against truncated mbufs by comparing rte_pktmbuf_pkt_len(pkt) with sizeof(struct mt_udp_hdr) and bailing with EBADMSG if the headers aren’t fully present.
  • Recomputed the payload pointer via rte_pktmbuf_mtod_offset and validated the UDP payload length against both the UDP header value and the actual bytes available in the mbuf before any rte_memcpy, preventing the out-of-bounds read.
  • Logged richer diagnostics (using signed widths) and set errno when malformed packets are detected so callers receive a clear failure instead of silent drops.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a critical security vulnerability in the UDP receive path by adding comprehensive validation to prevent out-of-bounds buffer reads. The changes guard against malformed or truncated packets that could cause memory safety issues.

Key changes:

  • Added packet length validation before header access to ensure headers are fully present
  • Implemented payload bounds checking against both UDP header length and actual mbuf capacity
  • Enhanced error reporting with detailed diagnostics and proper errno setting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…eader/payload bounds checks, switching to a safe payload pointer, and rebuilding to ensure everything still compiles—here’s the rundown.

Actions taken
Guarded udp_rx_dequeue against truncated mbufs by comparing rte_pktmbuf_pkt_len(pkt) with sizeof(struct mt_udp_hdr) and bailing with EBADMSG if the headers aren’t fully present.
Recomputed the payload pointer via rte_pktmbuf_mtod_offset and validated the UDP payload length against both the UDP header value and the actual bytes available in the mbuf before any rte_memcpy, preventing the out-of-bounds read.
Logged richer diagnostics (using signed widths) and set errno when malformed packets are detected so callers receive a clear failure instead of silent drops.
@soopel soopel force-pushed the mswirydc_coverity_551169 branch from 78959ec to 0222502 Compare November 14, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants