011fe81
From a9c472a7eeec6816868dbccce6decaef3b3c62bb Mon Sep 17 00:00:00 2001
011fe81
From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=9F=D0=B5=D1=85=D0=BE?=
011fe81
 =?UTF-8?q?=D0=B2?= <roman_pekhov>
011fe81
Date: Sun, 22 Jun 2014 03:51:50 +0400
4dcaf21
Subject: [PATCH 087/143] 	* grub-core/commands/loadenv.c
011fe81
 (check_blocklists): Fix overlap check.
011fe81
011fe81
---
011fe81
 ChangeLog                    |  4 ++++
011fe81
 grub-core/commands/loadenv.c | 13 ++-----------
011fe81
 2 files changed, 6 insertions(+), 11 deletions(-)
011fe81
011fe81
diff --git a/ChangeLog b/ChangeLog
011fe81
index 4ce6643..a2da974 100644
011fe81
--- a/ChangeLog
011fe81
+++ b/ChangeLog
011fe81
@@ -1,3 +1,7 @@
011fe81
+2014-06-21  Роман Пехов <roman_pekhov>
011fe81
+
011fe81
+	* grub-core/commands/loadenv.c (check_blocklists): Fix overlap check.
011fe81
+
011fe81
 2014-06-21  Glenn Washburn <development@efficientek.com>
011fe81
 
011fe81
 	* util/grub-install.c: Fix handling of --disk-module.
011fe81
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
011fe81
index 6af8112..acd93d1 100644
011fe81
--- a/grub-core/commands/loadenv.c
011fe81
+++ b/grub-core/commands/loadenv.c
011fe81
@@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
011fe81
       for (q = p->next; q; q = q->next)
011fe81
         {
011fe81
 	  grub_disk_addr_t s1, s2;
011fe81
-	  grub_disk_addr_t e1, e2, t;
011fe81
+	  grub_disk_addr_t e1, e2;
011fe81
 
011fe81
 	  s1 = p->sector;
011fe81
 	  e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
011fe81
@@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
011fe81
 	  s2 = q->sector;
011fe81
 	  e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
011fe81
 
011fe81
-	  if (s2 > s1)
011fe81
-	    {
011fe81
-	      t = s2;
011fe81
-	      s2 = s1;
011fe81
-	      s1 = t;
011fe81
-	      t = e2;
011fe81
-	      e2 = e1;
011fe81
-	      e1 = t;
011fe81
-	    }
011fe81
-          if (e1 > s2)
011fe81
+	  if (s1 < e2 && s2 < e1)
011fe81
             {
011fe81
               /* This might be actually valid, but it is unbelievable that
011fe81
                  any filesystem makes such a silly allocation.  */
011fe81
-- 
37b39b7
1.9.3
011fe81