From a53bdcafce143490efc0156c135f9c1f0bc6936f Mon Sep 17 00:00:00 2001 From: nkraetzschmar <9020053+nkraetzschmar@users.noreply.github.com> Date: Thu, 19 Dec 2024 10:00:15 +0100 Subject: [PATCH] fix: correctly decode EFI vars --- prepare_source | 2 +- src/main.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/prepare_source b/prepare_source index 946c502..cc0cbf2 100755 --- a/prepare_source +++ b/prepare_source @@ -1,3 +1,3 @@ import_src src pkg=gardenlinux-update -version=0.6 +version=0.7 diff --git a/src/main.go b/src/main.go index 0676542..22c4827 100644 --- a/src/main.go +++ b/src/main.go @@ -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") }