Skip to content

net: bootp: bound DHCP option parsing by the received packet length

Pranav Rajendran u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: bootp: validate DHCP option length before parsing itnet/bootp.c+12 -30 replies
2/2net: bootp: bound DHCP option parsing by the received packet lengthnet/bootp.c+19 -81 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] net: bootp: bound DHCP option parsing by the received packet length

Jerome pointed out on v1 that bounding dhcp_packet_process_options() by the received length isn't enough on its own: dhcp_process_options() itself reads the option-length byte and the option payload without checking either is inside [popt, end), so a packet truncated right after an option code byte (or with a length byte that overruns the buffer) still walks off the end even with the outer bound fixed.

v2 adds a prerequisite patch (1/2) that closes that inner gap first, then rebases the original outer-bound fix (2/2, unchanged from v1) on top of it. With both applied, a short reply now stops parsing at the first truncated option instead of reading past the receive buffer, regardless of whether the truncation lands on the outer BOOTP_HDR_SIZE boundary or inside an individual option.

Both patches are checkpatch --strict clean and build warning-free at W=1 for net/bootp.o; a full sandbox build also succeeds.

Pranav Rajendran (2):
net: bootp: validate DHCP option length before parsing it
net: bootp: bound DHCP option parsing by the received packet length

 net/bootp.c | 42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)