ripd: add full RTE bounds check to response/request processing loops#21889
ripd: add full RTE bounds check to response/request processing loops#21889DeadPackets wants to merge 1 commit into
Conversation
The RTE iteration loops in rip_response_process(), rip_request_process(), and rip_packet_dump() check only that the start of each struct rte (20 bytes) is within bounds, not that the full struct fits. While currently protected by an alignment check in rip_read(), adding an explicit bounds check provides defense-in-depth and guards against future refactoring that might remove or alter the caller's validation. Change the loop condition from (caddr_t)rte < lim to (caddr_t)(rte + 1) <= lim in all three functions. Signed-off-by: vulnagent3 <vulnagent3@oss-vuln-research.local>
Greptile SummaryThis PR tightens the RTE iteration loop bounds in
Confidence Score: 4/5Safe to merge; the loop condition changes are semantically correct for all packets that reach these functions, and the upstream alignment gate remains unchanged. The three loop fixes are correct and produce identical behaviour for well-formed packets while closing a theoretical over-read for misaligned ones. The one gap is that ripd/ripd.c — specifically the pre-loop RTE field reads in Important Files Changed
|
|
so I have to ask: are you an actual human being? the sign-off in the commit here sounds like a program, not a person. |
Summary
Adds a full RTE bounds check to the RIP response/request processing loops in
ripd/ripd.c.The RTE iteration loops in
rip_response_process(),rip_request_process(), andrip_packet_dump()check only that the start of eachstruct rte(20 bytes) is within bounds, not that the full struct fits. While currently protected by an upstream alignment check inrip_read(), adding an explicit bounds check provides defense-in-depth and guards against future refactoring that might remove or alter the caller's validation.Changes
rip_response_process()(line 1188):(caddr_t)rte < lim→(caddr_t)(rte + 1) <= limrip_request_process()(line 1721):((caddr_t)rte) < lim→((caddr_t)(rte + 1)) <= limrip_packet_dump()(line 740):(caddr_t)rte < lim→(caddr_t)(rte + 1) <= limTesting
--enable-ripdon Ubuntu 24.04 / gcc 13.3.0Related
No existing issues or CVEs for this specific pattern. This is a proactive hardening change.