git: 191462cb674c - stable/14 - efibootmgr: fix potential endless loop with -v
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Feb 2024 15:12:31 UTC
The branch stable/14 has been updated by avg:
URL: https://cgit.FreeBSD.org/src/commit/?id=191462cb674c092de392aa8e31054115d9aa74f8
commit 191462cb674c092de392aa8e31054115d9aa74f8
Author: Andriy Gapon <avg@FreeBSD.org>
AuthorDate: 2022-10-25 21:10:39 +0000
Commit: Andriy Gapon <avg@FreeBSD.org>
CommitDate: 2024-02-17 14:18:04 +0000
efibootmgr: fix potential endless loop with -v
I observed the problem on a system with fairly old and, apparently,
buggy EFI implementation. A list of boot devices had an invalid
trailing entry. efidp_size() for that entry returned zero, which means
that the code got stuck looping on that entry.
(cherry picked from commit bf87d4a4bfaa86e97079754e93fe14595adf07c5)
---
usr.sbin/efibootmgr/efibootmgr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c
index 8dcf9876486d..be1157b4aa84 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -784,6 +784,8 @@ print_loadopt_str(uint8_t *data, size_t datalen)
*/
indent = 1;
while (dp < edp) {
+ if (efidp_size(dp) == 0)
+ break;
efidp_format_device_path(buf, sizeof(buf), dp,
(intptr_t)(void *)edp - (intptr_t)(void *)dp);
printf("%*s%s\n", indent, "", buf);