Skip to content

Commit

Permalink
efihex error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Hristo Asenov authored and 0x5a17ed committed Nov 19, 2022
1 parent 1a50e89 commit 4a7cfcb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions efi/efihex/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ package efihex
const hexTable = "0123456789ABCDEF"

func EncodeBigEndian(dst, src []byte) {
if len(src) <= 0 {
return
}

_ = dst[len(src)*2-1] // bounds check hint to compiler
for i, j := 0, 0; i < len(src); i, j = i+1, j+2 {
dst[j], dst[j+1] = hexTable[src[i]>>4], hexTable[src[i]&0x0f]
Expand Down

0 comments on commit 4a7cfcb

Please sign in to comment.