Skip to content

Commit

Permalink
OcFileLib: Provide workaround for buggy drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Jul 16, 2020
1 parent 7b445b2 commit 592d2ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Library/OcFileLib/GetFileInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcFileLib.h>
#include <Library/OcGuardLib.h>

VOID *
GetFileInfo (
Expand All @@ -52,6 +53,12 @@ GetFileInfo (
);

if (Status == EFI_BUFFER_TOO_SMALL && FileInfoSize >= MinFileInfoSize) {
//
// Some drivers (i.e. built-in 32-bit Apple HFS driver) may possibly omit null terminators from file info data.
//
if (CompareGuid (InformationType, &gEfiFileInfoGuid) && OcOverflowAddUN (FileInfoSize, sizeof (CHAR16), &FileInfoSize)) {
return NULL;
}
FileInfoBuffer = AllocateZeroPool (FileInfoSize);

if (FileInfoBuffer != NULL) {
Expand Down

0 comments on commit 592d2ac

Please sign in to comment.