From 4a91d376134c918c92348e56d7f5bcb092ba4117 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 1 Apr 2024 23:20:38 -0400 Subject: multiboot_select plugin check volume root for valid firmware Change-Id: I5feb4b00ae385ff8967de27682d4e4a528dc2ae5 --- apps/plugins/multiboot_select.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/plugins/multiboot_select.c b/apps/plugins/multiboot_select.c index 63babbb2c1..993a47c0e4 100644 --- a/apps/plugins/multiboot_select.c +++ b/apps/plugins/multiboot_select.c @@ -155,14 +155,17 @@ static int find_roots(void) struct dirent* ent; while((ent = rb->readdir(dir))) { + const char *dname = ent->d_name; + if (*dname == '.' && *(dname + 1) == '\0') + dname++; /* skip the dot so we can check root of volume */ int r = rb->snprintf(tmpbuf, sizeof(tmpbuf), "/<%d>/%s/%s/%s", - vol, ent->d_name, bootdir, BOOTFILE); + vol, dname, bootdir, BOOTFILE); if(r < 0 || (size_t)r >= sizeof(tmpbuf)) continue; if(check_firmware(tmpbuf)) { rb->snprintf(roots[nroots], MAX_PATH, "/<%d>/%s", - vol, ent->d_name); + vol, dname); nroots += 1; /* quit if we hit the maximum */ -- cgit v1.2.3