nalika / rpms / grub2

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