Blame SOURCES/0185-Fix-security-issue-when-reading-username-and-passwor.patch

6b3c76
From 8e0cdc0c0cdb3be1ed0e3ed0abd382c924b56a9e Mon Sep 17 00:00:00 2001
a85e8e
From: Hector Marco-Gisbert <hecmargi@upv.es>
a85e8e
Date: Fri, 13 Nov 2015 16:21:09 +0100
6b3c76
Subject: [PATCH 185/261] Fix security issue when reading username and password
a85e8e
a85e8e
  This patch fixes two integer underflows at:
a85e8e
    * grub-core/lib/crypto.c
a85e8e
    * grub-core/normal/auth.c
a85e8e
a85e8e
Resolves: CVE-2015-8370
a85e8e
a85e8e
Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
a85e8e
Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
a85e8e
---
a85e8e
 grub-core/lib/crypto.c  | 2 +-
a85e8e
 grub-core/normal/auth.c | 2 +-
a85e8e
 2 files changed, 2 insertions(+), 2 deletions(-)
a85e8e
a85e8e
diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
6b3c76
index 8e8426c4a..a23519cb3 100644
a85e8e
--- a/grub-core/lib/crypto.c
a85e8e
+++ b/grub-core/lib/crypto.c
a85e8e
@@ -456,7 +456,7 @@ grub_password_get (char buf[], unsigned buf_size)
a85e8e
 	  break;
a85e8e
 	}
a85e8e
 
a85e8e
-      if (key == '\b')
a85e8e
+      if (key == '\b' && cur_len)
a85e8e
 	{
a85e8e
 	  cur_len--;
a85e8e
 	  continue;
a85e8e
diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
6b3c76
index c6bd96e28..5782ec5a9 100644
a85e8e
--- a/grub-core/normal/auth.c
a85e8e
+++ b/grub-core/normal/auth.c
a85e8e
@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size)
a85e8e
 	  break;
a85e8e
 	}
a85e8e
 
a85e8e
-      if (key == '\b')
a85e8e
+      if (key == '\b' && cur_len)
a85e8e
 	{
a85e8e
 	  cur_len--;
a85e8e
 	  grub_printf ("\b");
6b3c76
-- 
6b3c76
2.13.5
6b3c76