Skip to content

Commit

Permalink
fix: correctly decode EFI vars
Browse files Browse the repository at this point in the history
  • Loading branch information
nkraetzschmar committed Dec 19, 2024
1 parent 60a617a commit a53bdca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion prepare_source
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import_src src
pkg=gardenlinux-update
version=0.6
version=0.7
9 changes: 8 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ func checkEFI(expected_loader_entry string) error {
return errors.New("not booted with systemd EFI stub")
}

loader_entry := string(data[4:])
var utf8_data []byte
for i := 4; i < len(data); i += 2 {
utf8_data = append(utf8_data, data[i])
}

loader_entry := string(utf8_data)
loader_entry = strings.Trim(loader_entry, "\x00")

if loader_entry != expected_loader_entry {
return errors.New("booted entry does not match expected value")
}
Expand Down

0 comments on commit a53bdca

Please sign in to comment.