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

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