diff --git a/internal/decoder/bytes.go b/internal/decoder/bytes.go index e0619be..0c4681a 100644 --- a/internal/decoder/bytes.go +++ b/internal/decoder/bytes.go @@ -49,10 +49,11 @@ func (d *bytesDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) er } decodedLen := base64.StdEncoding.DecodedLen(len(bytes)) buf := make([]byte, decodedLen) - if _, err := base64.StdEncoding.Decode(buf, bytes); err != nil { + n, err := base64.StdEncoding.Decode(buf, bytes) + if err != nil { return err } - *(*[]byte)(p) = buf + *(*[]byte)(p) = buf[:n] s.reset() return nil }