summaryrefslogtreecommitdiff
path: root/sys-boot/grub/files/CVE-2015-8370.patch
blob: 69e419ee0c3c3b6cd2a3c53fd5041cb312a94262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 451d80e52d851432e109771bb8febafca7a5f1f2 Mon Sep 17 00:00:00 2001
From: Hector Marco-Gisbert <hecmargi@upv.es>
Date: Wed, 16 Dec 2015 07:57:18 +0300
Subject: [PATCH] Fix security issue when reading username and password

This patch fixes two integer underflows at:
  * grub-core/lib/crypto.c
  * grub-core/normal/auth.c

CVE-2015-8370

Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
Also-By: Andrey Borzenkov <arvidjaar@gmail.com>
---
 grub-core/lib/crypto.c  | 3 ++-
 grub-core/normal/auth.c | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
index 010e550..683a8aa 100644
--- a/grub-core/lib/crypto.c
+++ b/grub-core/lib/crypto.c
@@ -470,7 +470,8 @@ grub_password_get (char buf[], unsigned buf_size)
 
       if (key == '\b')
 	{
-	  cur_len--;
+	  if (cur_len)
+	    cur_len--;
 	  continue;
 	}
 
diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
index c6bd96e..8615c48 100644
--- a/grub-core/normal/auth.c
+++ b/grub-core/normal/auth.c
@@ -174,8 +174,11 @@ grub_username_get (char buf[], unsigned buf_size)
 
       if (key == '\b')
 	{
-	  cur_len--;
-	  grub_printf ("\b");
+	  if (cur_len)
+	    {
+	      cur_len--;
+	      grub_printf ("\b");
+	    }
 	  continue;
 	}
 
-- 
2.6.4