Skip to content

Commit

Permalink
remove null bytes from error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Dec 12, 2023
1 parent f288793 commit 0c69115
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/types_stun.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package internal

import (
"bytes"
"encoding/binary"
"fmt"

Expand Down Expand Up @@ -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")),
}
}

Expand Down

0 comments on commit 0c69115

Please sign in to comment.