nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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