Skip to content

Commit

Permalink
[uefi] fix search for bootloaders in FAT images that have an 'EFI' vo…
Browse files Browse the repository at this point in the history
…lume label

* Per https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#Directory_entry it
  is possible to have a FAT directory entry with a 'EFI' volume label alongside with
  a 'EFI' subdirectory.
* If that happens, then the current Syslinux libfat_searchdir() code may treat the
  'EFI' volume label as an empty subdirectory and say that there are no bootloaders,
  even if the 'EFI\Boot\Boot###.efi' binaries really do exist.
* Fix this by filtering out entries with the 'volume label' attribute (0x08).
* For good measure, also filter out entries with the 'device' attribute (0x40), as
  it is technically possible to create a 'EFI' device leading to the same issue.
* Closes #2288.
* Closes #2289.
  • Loading branch information
AJIOB authored and pbatard committed Jul 24, 2023
1 parent 64e85ed commit b81b440
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/rufus.rc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.2.2072"
CAPTION "Rufus 4.2.2073"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
Expand Down Expand Up @@ -392,8 +392,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,2,2072,0
PRODUCTVERSION 4,2,2072,0
FILEVERSION 4,2,2073,0
PRODUCTVERSION 4,2,2073,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.2.2072"
VALUE "FileVersion", "4.2.2073"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "� 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.2.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.2.2072"
VALUE "ProductVersion", "4.2.2073"
END
END
BLOCK "VarFileInfo"
Expand Down
3 changes: 2 additions & 1 deletion src/syslinux/libfat/searchdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ int32_t libfat_searchdir(struct libfat_filesystem *fs, int32_t dirclust,

for (nent = 0; nent < LIBFAT_SECTOR_SIZE;
nent += sizeof(struct fat_dirent)) {
if (!memcmp(dep->name, name, 11)) {
/* Filter out volume labels (0x08) and devices (0x40) from the search */
if (!(dep->attribute & 0x48) && !memcmp(dep->name, name, 11)) {
if (direntry) {
memcpy(direntry->entry, dep, sizeof(*dep));
direntry->sector = s;
Expand Down

0 comments on commit b81b440

Please sign in to comment.