Skip to content

Commit

Permalink
pkg/uefi/meregion: fall back so scanning whole region for FPT
Browse files Browse the repository at this point in the history
MEAnalyzer does the same thing. There are images where the
FPT is not at the beginning of the ME region, e.g.:
https://www.gigabyte.com/Motherboard/H410M-H-V3-rev-10-12/support#support-dl-bios

Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Sep 28, 2024
1 parent 8d9c09a commit 6722304
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/uefi/meregion.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func FindMEDescriptor(buf []byte) (int, error) {
// + 4 since the descriptor starts after the signature
return len(MEFPTSignature), nil
}
fptOffset := bytes.Index(buf, MEFPTSignature)
if fptOffset > 0 {
fmt.Printf("FPT Signature @ 0x%x\n", fptOffset)
return fptOffset + len(MEFPTSignature), nil
}
return -1, fmt.Errorf("ME Flash Partition Table signature %#02x not found: first 20 bytes are:\n%s", MEFPTSignature, hex.Dump(buf[:20]))
}

Expand Down

0 comments on commit 6722304

Please sign in to comment.