Skip to content

Commit

Permalink
go/storage/mkvs/urkel: fix invalid memory access when unmarshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Jan 29, 2020
1 parent 9e89921 commit 2f70937
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .changelog/2611.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/storage: Fix invalid memory access crash in Urkel tree
3 changes: 2 additions & 1 deletion go/storage/mkvs/urkel/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ func (n *LeafNode) SizedUnmarshalBinary(data []byte) (int, error) {
valueSize := int(binary.LittleEndian.Uint32(data[pos : pos+ValueLengthSize]))
pos += ValueLengthSize

value := data[pos : pos+valueSize]
value := make([]byte, valueSize)
copy(value, data[pos:pos+valueSize])
pos += valueSize

n.Clean = true
Expand Down

0 comments on commit 2f70937

Please sign in to comment.