mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Update util.go
This commit is contained in:
parent
de6ff36f36
commit
c53814c223
1 changed files with 2 additions and 1 deletions
|
|
@ -53,7 +53,8 @@ func memoryCopy(m []byte, offset, size int64) (cpy []byte) {
|
|||
return nil
|
||||
}
|
||||
|
||||
if len(m) > int(offset) {
|
||||
// Check that we have enough data in the slice to safely copy the requested range
|
||||
if len(m) > int(offset) && int(offset+size) <= len(m) {
|
||||
cpy = make([]byte, size)
|
||||
copy(cpy, m[offset:offset+size])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue