Blame SOURCES/0133-trim-arp-packets-with-abnormal-size.patch

f731ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f731ee
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
f731ee
Date: Wed, 5 Feb 2014 09:42:42 -0200
f731ee
Subject: [PATCH] trim arp packets with abnormal size
f731ee
f731ee
GRUB uses arp request to create the arp response. If the incoming packet
f731ee
is foobared, GRUB needs to trim the arp response packet before sending it.
f731ee
---
f731ee
 grub-core/net/arp.c | 6 ++++++
f731ee
 1 file changed, 6 insertions(+)
f731ee
f731ee
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
f731ee
index d62d0cc1e01..77581f4b29a 100644
f731ee
--- a/grub-core/net/arp.c
f731ee
+++ b/grub-core/net/arp.c
f731ee
@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,
f731ee
     if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
f731ee
 	&& grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST)
f731ee
       {
f731ee
+        if ((nb->tail - nb->data) > 50)
f731ee
+          {
f731ee
+            grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
f731ee
+                         nb->tail - nb->data);
f731ee
+            nb->tail = nb->data + 50;
f731ee
+          }
f731ee
 	grub_net_link_level_address_t target;
f731ee
 	/* We've already checked that pln is either 4 or 16.  */
f731ee
 	char tmp[16];