dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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