public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Gray Remlin <g_remlin@rocketmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix potential empty Parameter Request List
Date: Fri, 15 Oct 2010 15:53:36 +0100	[thread overview]
Message-ID: <4CB86AF0.6050301@rocketmail.com> (raw)

 Signed-off-by: Gray Remlin <g_remlin@rocketmail.com>

---
 net/bootp.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index e679f8b..1289e3b 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -417,8 +417,21 @@ static int DhcpExtended (u8 * e, int message_type,
IPaddr_t ServerID, IPaddr_t R
                return x - start;
 #endif

+/*
+ * RFC2132: An empty Parameter Request List is not legitimate,
+ * it must have at minimum one request.
+ */
+#if defined(CONFIG_BOOTP_SUBNETMASK) || \
+    defined(CONFIG_BOOTP_TIMEOFFSET) || \
+    defined(CONFIG_BOOTP_GATEWAY) || \
+    defined(CONFIG_BOOTP_DNS) || \
+    defined(CONFIG_BOOTP_HOSTNAME) || \
+    defined(CONFIG_BOOTP_BOOTFILESIZE) || \
+    defined(CONFIG_BOOTP_BOOTPATH) || \
+    defined(CONFIG_BOOTP_NISDOMAIN) || \
+    defined(CONFIG_BOOTP_NTPSERVER)
        *e++ = 55;              /* Parameter Request List */
-        cnt = e++;             /* Pointer to count of requested items */
+       cnt = e++;              /* Pointer to count of requested items */
        *cnt = 0;
 #if defined(CONFIG_BOOTP_SUBNETMASK)
        *e++  = 1;              /* Subnet Mask */
@@ -456,6 +469,7 @@ static int DhcpExtended (u8 * e, int message_type,
IPaddr_t ServerID, IPaddr_t R
        *e++  = 42;
        *cnt += 1;
 #endif
+#endif
        *e++  = 255;            /* End of the list */

        /* Pad to minimal length */
--

                 reply	other threads:[~2010-10-15 14:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4CB86AF0.6050301@rocketmail.com \
    --to=g_remlin@rocketmail.com \
    --cc=u-boot@lists.denx.de \
    /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