Skip to content

DevicePaths may contain unaligned data including strings #951

@vit9696

Description

@vit9696

A very common example of such DevicePath is FILEPATH_DEVICE_PATH. Triggered here:

      //
      // Detect macOS recovery by com.apple.recovery.boot in the bootloader path.
      //
      if (Type == OC_BOOT_UNKNOWN) {
        ASSERT (((UINTN) LastNode->PathName & BIT0) == 0);
        if (OcStrStrLength (LastNode->PathName, PathLen,
          L"com.apple.recovery.boot", L_STR_LEN (L"com.apple.recovery.boot")) != NULL) {
          Type = OC_BOOT_APPLE_RECOVERY;
        } else if (OcStrStrLength (LastNode->PathName, PathLen,
          L"EFI\\APPLE", L_STR_LEN (L"EFI\\APPLE")) != NULL) {
          //
          // FIXME: Support separate file path nodes. Potentially introduce a
          //        retrieval function that uses a preallocated buffer.
          //
          Type = OC_BOOT_APPLE_FW_UPDATE;
        }
      }

We probably need to implement a function that will copy path from DevicePath to the string a stack allocated buffer everywhere…

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions