Blame SOURCES/0087-grub-core-commands-loadenv.c-check_blocklists-Fix-ov.patch

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