u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Pranav Rajendran <pranavkasthuri@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>,
	Jerome Forissier <jerome.forissier@arm.com>,
	Pranav Rajendran <pranavkasthuri@gmail.com>
Subject: [PATCH v2 0/2] net: bootp: bound DHCP option parsing by the received packet length
Date: Thu, 20 Aug 2026 13:33:13 +0100	[thread overview]
Message-ID: <20260820123315.9272-1-pranavkasthuri@gmail.com> (raw)
In-Reply-To: <20260815220817.11754-1-pranavkasthuri@gmail.com>

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(-)

-- 
2.50.1 (Apple Git-155)


  parent reply	other threads:[~2026-08-20 12:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-15 22:08 [PATCH v1] net: bootp: bound DHCP option parsing by the received packet length Pranav Rajendran
2026-08-20 11:49 ` Jerome Forissier
2026-08-20 12:33 ` Pranav Rajendran [this message]
2026-08-20 12:33   ` [PATCH v2 1/2] net: bootp: validate DHCP option length before parsing it Pranav Rajendran
2026-08-20 12:33   ` [PATCH v2 2/2] net: bootp: bound DHCP option parsing by the received packet length Pranav Rajendran
2026-08-20 12:48     ` Pranav R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260820123315.9272-1-pranavkasthuri@gmail.com \
    --to=pranavkasthuri@gmail.com \
    --cc=jerome.forissier@arm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).