11bc4340c08d559ec00c8303740d4512f3cb1a12
[openwrt/openwrt.git] / package / boot / grub2 / patches / 300-CVE-2015-8370.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Hector Marco-Gisbert <hecmargi@upv.es>
3 Date: Fri, 13 Nov 2015 16:21:09 +0100
4 Subject: [PATCH] Fix security issue when reading username and password
5
6 This patch fixes two integer underflows at:
7 * grub-core/lib/crypto.c
8 * grub-core/normal/auth.c
9
10 Resolves: CVE-2015-8370
11
12 Signed-off-by: Hector Marco-Gisbert <hecmargi@upv.es>
13 Signed-off-by: Ismael Ripoll-Ripoll <iripoll@disca.upv.es>
14 ---
15 grub-core/lib/crypto.c | 2 +-
16 grub-core/normal/auth.c | 2 +-
17 2 files changed, 2 insertions(+), 2 deletions(-)
18
19 diff --git a/grub-core/lib/crypto.c b/grub-core/lib/crypto.c
20 index ca334d5a40e..e6c78d16d39 100644
21 --- a/grub-core/lib/crypto.c
22 +++ b/grub-core/lib/crypto.c
23 @@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned buf_size)
24 break;
25 }
26
27 - if (key == '\b')
28 + if (key == '\b' && cur_len)
29 {
30 if (cur_len)
31 cur_len--;
32 diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
33 index 6be678c0de1..c35ce972473 100644
34 --- a/grub-core/normal/auth.c
35 +++ b/grub-core/normal/auth.c
36 @@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned buf_size)
37 break;
38 }
39
40 - if (key == GRUB_TERM_BACKSPACE)
41 + if (key == GRUB_TERM_BACKSPACE && cur_len)
42 {
43 if (cur_len)
44 {