Skip to content

Commit 396dee8

Browse files
authored
Merge pull request #52 from cloudstruct/bugfix/set-cbor-copy
Allocate buffer and copy data when setting message CBOR
2 parents 107492b + 522123f commit 396dee8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

protocol/message.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ type MessageBase struct {
1515
}
1616

1717
func (m *MessageBase) SetCbor(data []byte) {
18-
m.rawCbor = data
18+
m.rawCbor = make([]byte, len(data))
19+
copy(m.rawCbor, data)
1920
}
2021

2122
func (m *MessageBase) Cbor() []byte {

0 commit comments

Comments
 (0)