From 0c691156696cc7ee32187855261b1c038ff6c2c9 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer <105281+firefart@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:39:24 +0100 Subject: [PATCH] remove null bytes from error messages --- internal/types_stun.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/types_stun.go b/internal/types_stun.go index 9550b4e5..8890a1dc 100644 --- a/internal/types_stun.go +++ b/internal/types_stun.go @@ -1,6 +1,7 @@ package internal import ( + "bytes" "encoding/binary" "fmt" @@ -316,7 +317,7 @@ func ParseError(buf []byte) Error { errorText := buf[4:] return Error{ ErrorCode: ErrorCode(errorCode), - ErrorText: string(errorText), + ErrorText: string(bytes.Trim(errorText, "\x00")), } }