dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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