dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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