Skip to content

Commit 0c69115

Browse files
committed
remove null bytes from error messages
1 parent f288793 commit 0c69115

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/types_stun.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package internal
22

33
import (
4+
"bytes"
45
"encoding/binary"
56
"fmt"
67

@@ -316,7 +317,7 @@ func ParseError(buf []byte) Error {
316317
errorText := buf[4:]
317318
return Error{
318319
ErrorCode: ErrorCode(errorCode),
319-
ErrorText: string(errorText),
320+
ErrorText: string(bytes.Trim(errorText, "\x00")),
320321
}
321322
}
322323

0 commit comments

Comments
 (0)