Skip to content

Commit

Permalink
Copy byte array when unmarshalling RawMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
niallnsec committed Dec 8, 2022
1 parent a209843 commit 573107b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func (v *RawMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {

// UnmarshalJSON implements encoding/json.Unmarshaler interface.
func (v *RawMessage) UnmarshalJSON(data []byte) error {
*v = data
*v = make([]byte, len(data))
copy(*v, data)
return nil
}

Expand Down

0 comments on commit 573107b

Please sign in to comment.