* [tip: efi/urgent] efi/libstub: prevent read overflow in find_file_option()
@ 2021-05-23 9:46 tip-bot2 for Dan Carpenter
0 siblings, 0 replies; only message in thread
From: tip-bot2 for Dan Carpenter @ 2021-05-23 9:46 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Dan Carpenter, Ard Biesheuvel, x86, linux-kernel
The following commit has been merged into the efi/urgent branch of tip:
Commit-ID: c4039b29fe9637e1135912813f830994af4c867f
Gitweb: https://git.kernel.org/tip/c4039b29fe9637e1135912813f830994af4c867f
Author: Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Fri, 23 Apr 2021 14:48:31 +03:00
Committer: Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Sat, 22 May 2021 14:05:32 +02:00
efi/libstub: prevent read overflow in find_file_option()
If the buffer has slashes up to the end then this will read past the end
of the array. I don't anticipate that this is an issue for many people
in real life, but it's the right thing to do and it makes static
checkers happy.
Fixes: 7a88a6227dc7 ("efi/libstub: Fix path separator regression")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
index 4e81c60..dd95f33 100644
--- a/drivers/firmware/efi/libstub/file.c
+++ b/drivers/firmware/efi/libstub/file.c
@@ -103,7 +103,7 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,
return 0;
/* Skip any leading slashes */
- while (cmdline[i] == L'/' || cmdline[i] == L'\\')
+ while (i < cmdline_len && (cmdline[i] == L'/' || cmdline[i] == L'\\'))
i++;
while (--result_len > 0 && i < cmdline_len) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-23 9:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 9:46 [tip: efi/urgent] efi/libstub: prevent read overflow in find_file_option() tip-bot2 for Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®