All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] autoboot: fix illegal memory access when stop key and delay key are empty
@ 2021-01-15  3:11 Yuezhang.Mo at sony.com
  2021-01-15 12:19 ` Heinrich Schuchardt
  2021-01-28 23:58 ` Tom Rini
  0 siblings, 2 replies; 6+ messages in thread
From: Yuezhang.Mo at sony.com @ 2021-01-15  3:11 UTC (permalink / raw)
  To: u-boot

If both stop key and delay key are empty, the length of these
keys is 0. The subtraction operation will cause the u_int type
variable to overflow, will cause illegal memory access in key
input loop.

This commit fixes this bug by using int type instead of u_init.
---
 common/autoboot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index e628baffb8..61fb09f910 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -156,9 +156,9 @@ static int passwd_abort_key(uint64_t etime)
 	};
 
 	char presskey[MAX_DELAY_STOP_STR];
-	u_int presskey_len = 0;
-	u_int presskey_max = 0;
-	u_int i;
+	int presskey_len = 0;
+	int presskey_max = 0;
+	int i;
 
 #  ifdef CONFIG_AUTOBOOT_DELAY_STR
 	if (delaykey[0].str == NULL)
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-28 23:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  3:11 [PATCH] autoboot: fix illegal memory access when stop key and delay key are empty Yuezhang.Mo at sony.com
2021-01-15 12:19 ` Heinrich Schuchardt
2021-01-18  5:22   ` Andy.Wu at sony.com
2021-01-18  5:38     ` Andy.Wu at sony.com
2021-01-18  7:37       ` Heinrich Schuchardt
2021-01-28 23:58 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.