From 3543a25cd74b6ef766562aff0919beb302a04c12 Mon Sep 17 00:00:00 2001 From: jo Date: Sun, 2 Sep 2018 19:22:37 +0200 Subject: [PATCH] Fix NULL chars in string while reading id3v11 tags --- util.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util.go b/util.go index ec28ac6..4858802 100644 --- a/util.go +++ b/util.go @@ -5,6 +5,7 @@ package tag import ( + "bytes" "encoding/binary" "io" ) @@ -46,7 +47,7 @@ func readString(r io.Reader, n int) (string, error) { if err != nil { return "", err } - return string(b), nil + return string(bytes.Trim(b, "\x00")), nil } func readInt(r io.Reader, n int) (int, error) {