2ae5c1e
From eb1adf51b18aaa62078bddf91439ca054b6f7965 Mon Sep 17 00:00:00 2001
f4c76c0
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
f4c76c0
Date: Wed, 5 Feb 2014 09:42:42 -0200
2ae5c1e
Subject: [PATCH 05/85] trim arp packets with abnormal size
f4c76c0
f4c76c0
GRUB uses arp request to create the arp response. If the incoming packet
f4c76c0
is foobared, GRUB needs to trim the arp response packet before sending it.
f4c76c0
---
f4c76c0
 grub-core/net/arp.c | 6 ++++++
f4c76c0
 1 file changed, 6 insertions(+)
f4c76c0
f4c76c0
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
f4c76c0
index 4b68c41..f7c59d3 100644
f4c76c0
--- a/grub-core/net/arp.c
f4c76c0
+++ b/grub-core/net/arp.c
f4c76c0
@@ -142,6 +142,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,
f4c76c0
     if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
f4c76c0
 	&& arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST))
f4c76c0
       {
f4c76c0
+        if ((nb->tail - nb->data) > 50)
f4c76c0
+          {
f4c76c0
+            grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
f4c76c0
+                         nb->tail - nb->data);
f4c76c0
+            nb->tail = nb->data + 50;
f4c76c0
+          }
f4c76c0
 	grub_net_link_level_address_t target;
f4c76c0
 	struct grub_net_buff nb_reply;
f4c76c0
 	struct arppkt *arp_reply;
f4c76c0
-- 
b9efc54
2.5.0
f4c76c0