From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W9G8B-00020r-TD for mharc-grub-devel@gnu.org; Fri, 31 Jan 2014 10:35:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9G80-0001yD-Kc for grub-devel@gnu.org; Fri, 31 Jan 2014 10:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9G7r-0006qo-8v for grub-devel@gnu.org; Fri, 31 Jan 2014 10:35:36 -0500 Received: from e24smtp05.br.ibm.com ([32.104.18.26]:35279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9G7q-0006mE-Tj for grub-devel@gnu.org; Fri, 31 Jan 2014 10:35:27 -0500 Received: from /spool/local by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 31 Jan 2014 13:35:24 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 31 Jan 2014 13:35:21 -0200 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 3048D1DC006C for ; Fri, 31 Jan 2014 10:35:21 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0VFZSPa4653302 for ; Fri, 31 Jan 2014 13:35:28 -0200 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0VFZK06027751 for ; Fri, 31 Jan 2014 13:35:20 -0200 Received: from beren.br.ibm.com ([9.8.9.186]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s0VFZBTM027416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 31 Jan 2014 13:35:20 -0200 Date: Fri, 31 Jan 2014 13:35:11 -0200 From: Paulo Flabiano Smorigo To: grub-devel@gnu.org Subject: [PATCH] grub-core/net/arp.c: trim arp packets with abnormal size. Message-ID: <20140131153509.GA26154@beren.br.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/null+5621 (d3096e8796e7) (2012-12-30) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14013115-1798-0000-0000-0000017EE6C0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.104.18.26 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2014 15:35:45 -0000 * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with abnormal size. GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it. This is just a fix in time for 2.02. I'm planning to rewrite the arp response code after the release. diff --git a/ChangeLog b/ChangeLog index cfa9c83..10e9c3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-01-31 Paulo Flabiano Smorigo + + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with + abnormal size. + + GRUB uses arp request to create the arp response. If the incoming packet is + foobared, GRUB needs to trim the arp response packet before sending it. + 2014-01-29 Vladimir Serbinenko * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c index d62d0cc..77581f4 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 && grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST) { + if ((nb->tail - nb->data) > 50) + { + grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n", + nb->tail - nb->data); + nb->tail = nb->data + 50; + } grub_net_link_level_address_t target; /* We've already checked that pln is either 4 or 16. */ char tmp[16]; -- Paulo Flabiano Smorigo IBM Linux Technology Center