Skip to content

Commit

Permalink
Really fix ae7b85
Browse files Browse the repository at this point in the history
The previous fix leaves /half/ or /one quarter/ of the UINTN
uninitialized, which has hilarious and unfortunate results.  Instead,
copy the value to an intermediate UINT16.

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Aug 16, 2016
1 parent d218648 commit fcc2249
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion efi/fwupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,10 @@ open_file(EFI_DEVICE_PATH *dp, EFI_FILE_HANDLE *fh)
return EFI_UNSUPPORTED;
}

UINT16 sz16;
UINTN sz;
CopyMem(&sz, &file_dp->Length[0], 2);
CopyMem(&sz16, &file_dp->Length[0], sizeof(sz16));
sz = sz16;
sz -= 4;
if (sz <= 6 || sz % 2 != 0) {
Print(L"%a:%a():%d: Invalid file device path.\n",
Expand Down

0 comments on commit fcc2249

Please sign in to comment.