forked from TrueCloudLab/neoneo-go
Merge pull request #1475 from nspcc-dev/core/get_storage_items_fix
core: copy storage item key in simple.GetStorageItems
This commit is contained in:
commit
50d6cd6b0d
2 changed files with 5 additions and 1 deletions
|
@ -627,7 +627,9 @@ func (dao *Simple) GetStorageItems(hash util.Uint160, prefix []byte) ([]StorageI
|
|||
}
|
||||
|
||||
// Cut prefix and hash.
|
||||
s.Key = k[21:]
|
||||
// Must copy here, #1468.
|
||||
s.Key = make([]byte, len(k[21:]))
|
||||
copy(s.Key, k[21:])
|
||||
res = append(res, s)
|
||||
}
|
||||
dao.Store.Seek(makeStorageItemKey(hash, prefix), saveToMap)
|
||||
|
|
|
@ -42,6 +42,8 @@ type (
|
|||
Get([]byte) ([]byte, error)
|
||||
Put(k, v []byte) error
|
||||
PutBatch(Batch) error
|
||||
// Seek can guarantee that provided key (k) and value (v) are the only valid until the next call to f.
|
||||
// Key and value slices should not be modified.
|
||||
Seek(k []byte, f func(k, v []byte))
|
||||
Close() error
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue