c78952
From 571a6cce3b0d4c8abf11efc320e2de6ff9188d60 Mon Sep 17 00:00:00 2001
f4c76c
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
f4c76c
Date: Wed, 5 Feb 2014 09:42:42 -0200
c78952
Subject: [PATCH 077/229] trim arp packets with abnormal size
f4c76c
f4c76c
GRUB uses arp request to create the arp response. If the incoming packet
f4c76c
is foobared, GRUB needs to trim the arp response packet before sending it.
f4c76c
---
f4c76c
 grub-core/net/arp.c | 6 ++++++
f4c76c
 1 file changed, 6 insertions(+)
f4c76c
f4c76c
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
78e1a1
index 54306e3b16d..d1c69ed2b55 100644
f4c76c
--- a/grub-core/net/arp.c
f4c76c
+++ b/grub-core/net/arp.c
bc092b
@@ -150,6 +150,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
f4c76c
     if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
f4c76c
 	&& arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST))
f4c76c
       {
f4c76c
+        if ((nb->tail - nb->data) > 50)
f4c76c
+          {
78e1a1
+            grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n",
f4c76c
+                         nb->tail - nb->data);
f4c76c
+            nb->tail = nb->data + 50;
f4c76c
+          }
f4c76c
 	grub_net_link_level_address_t target;
f4c76c
 	struct grub_net_buff nb_reply;
f4c76c
 	struct arppkt *arp_reply;
f4c76c
-- 
ec4acb
2.15.0
f4c76c