From patchwork Tue Oct 19 14:04:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gray Remlin X-Patchwork-Id: 71887 Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id E70F8136320 for ; Tue, 19 Oct 2010 16:07:45 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id C7F31348C9D1 for ; Tue, 19 Oct 2010 16:07:45 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Tue, 19 Oct 2010 16:07:45 +0200 (CEST) Received: from murder ([192.168.6.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Tue, 19 Oct 2010 16:05:38 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Tue, 19 Oct 2010 16:05:37 +0200 Received: from scanner-4.m-online.net (scanner-4.mail.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id 9E2B61C000F7; Tue, 19 Oct 2010 16:05:37 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-1.m-online.net (Postfix) with ESMTP id 505F446C0AC; Tue, 19 Oct 2010 16:05:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 247052809D; Tue, 19 Oct 2010 16:05:28 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mEAeFI50hN2Q; Tue, 19 Oct 2010 16:05:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC96A2809E; Tue, 19 Oct 2010 16:05:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F71028098 for ; Tue, 19 Oct 2010 16:05:20 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X-3y5RNTsla2 for ; Tue, 19 Oct 2010 16:05:18 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from nm14.bullet.mail.ukl.yahoo.com (nm14.bullet.mail.ukl.yahoo.com [217.146.183.188]) by theia.denx.de (Postfix) with SMTP id 05E0028097 for ; Tue, 19 Oct 2010 16:05:16 +0200 (CEST) Received: from [217.146.183.180] by nm14.bullet.mail.ukl.yahoo.com with NNFMP; 19 Oct 2010 14:05:15 -0000 Received: from [217.146.183.41] by tm11.bullet.mail.ukl.yahoo.com with NNFMP; 19 Oct 2010 14:05:15 -0000 Received: from [127.0.0.1] by omp1026.mail.ukl.yahoo.com with NNFMP; 19 Oct 2010 14:05:12 -0000 X-Yahoo-Newman-Id: 704231.19981.bm@omp1026.mail.ukl.yahoo.com Received: (qmail 98798 invoked from network); 19 Oct 2010 14:05:12 -0000 Received: from phenom.research.lan (g_remlin@178.101.247.8 with plain) by smtp133.mail.ukl.yahoo.com with SMTP; 19 Oct 2010 14:05:11 +0000 GMT X-Yahoo-SMTP: cuoQNyCswBCkPlR5hugWtcAYMXb_2kD6BwSxvxHBn7VG_YHo X-YMail-OSG: CMxB_aoVM1mTmg4_.TXkfI.1e_3ksrlnUsW1KMKNrUtJBdr dU608L7qciGenh3SDuVMRM9wcHXNkwncu0tGJa0XZOz9gHOzU.onCFaOdnOF 0M.hKp_oSYydIxSKLvKuyPSZ_fGJ_hrsKiASIZN6J1udHZNLxWbaxPAFwFOu OScF.ijzqm8UsDqkfhX0jGR2KH0gYbiCWp02yrzFmT0Q1PVrl89sN8pI7Gm6 fAm8DEzszMclv6A-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4CBDA586.6040008@rocketmail.com> Date: Tue, 19 Oct 2010 15:04:54 +0100 From: Gray Remlin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.4 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: u-boot@lists.denx.de Cc: biggerbadderben@gmail.com Subject: [U-Boot] Fix potential empty DHCP Parameter Request List X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net Signed-off-by: Gray Remlin --- net/bootp.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) *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 */ -- 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)