mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
ethdb/memorydb: avoid corrupting prefix slice in NewIterator
append(prefix, start...) can mutate the caller's prefix slice when it has spare capacity. Build the start key with string concatenation instead.
This commit is contained in:
parent
e3b6d0c86f
commit
50bb1e7313
1 changed files with 1 additions and 1 deletions
|
|
@ -169,7 +169,7 @@ func (db *Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator {
|
|||
|
||||
var (
|
||||
pr = string(prefix)
|
||||
st = string(append(prefix, start...))
|
||||
st = string(prefix) + string(start)
|
||||
keys = make([]string, 0, len(db.db))
|
||||
values = make([][]byte, 0, len(db.db))
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue