nalika / rpms / grub2

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