From 62a406ec1bbab9955ba671d2e6b9efcf4018039e Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Mon, 12 Aug 2019 13:30:54 -0700 Subject: [PATCH 1/2] Trim null bytes from kernel version --- host/host_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/host_linux.go b/host/host_linux.go index e38b48b..272016d 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -380,7 +380,7 @@ func KernelVersionWithContext(ctx context.Context) (version string, err error) { if err != nil { return "", err } - return string(utsname.Release[:]), nil + return string(utsname.Release[:bytes.IndexByte(utsname.Release[:], 0)]), nil } func getSlackwareVersion(contents []string) string { From 25be4d08fe6a1ff50e85e6a2c09a213e2c87953c Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Mon, 12 Aug 2019 13:32:14 -0700 Subject: [PATCH 2/2] Trim null bytes from kernel arch --- host/host_posix.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/host/host_posix.go b/host/host_posix.go index a16e5a1..a1b2479 100644 --- a/host/host_posix.go +++ b/host/host_posix.go @@ -3,11 +3,13 @@ package host import ( + "bytes" + "golang.org/x/sys/unix" ) func kernelArch() (string, error) { var utsname unix.Utsname err := unix.Uname(&utsname) - return string(utsname.Machine[:]), err + return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), err }