mirror of https://github.com/goccy/go-json.git
Append NUL character to end of buffer
This commit is contained in:
parent
ceed634708
commit
2e232f1d63
4
json.go
4
json.go
|
@ -166,14 +166,14 @@ func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
|
|||
}
|
||||
|
||||
func Unmarshal(data []byte, v interface{}) error {
|
||||
src := make([]byte, len(data))
|
||||
src := make([]byte, len(data)+1) // append nul byte to end
|
||||
copy(src, data)
|
||||
var dec Decoder
|
||||
return dec.decodeForUnmarshal(src, v)
|
||||
}
|
||||
|
||||
func UnmarshalNoEscape(data []byte, v interface{}) error {
|
||||
src := make([]byte, len(data))
|
||||
src := make([]byte, len(data)+1) // append nul byte to end
|
||||
copy(src, data)
|
||||
var dec Decoder
|
||||
return dec.decodeForUnmarshalNoEscape(src, v)
|
||||
|
|
Loading…
Reference in New Issue