Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions eth/protocols/snap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ func ServiceGetAccountRangeQuery(chain *core.BlockChain, req *GetAccountRangePac
if req.Bytes > softResponseLimit {
req.Bytes = softResponseLimit
}
// Validate the request range
if bytes.Compare(req.Origin[:], req.Limit[:]) > 0 {
return nil, nil
}
// Retrieve the requested state and bail out if non existent
tr, err := trie.New(trie.StateTrieID(req.Root), chain.TrieDB())
if err != nil {
Expand Down Expand Up @@ -342,6 +346,10 @@ func ServiceGetStorageRangesQuery(chain *core.BlockChain, req *GetStorageRangesP
if req.Bytes > softResponseLimit {
req.Bytes = softResponseLimit
}
// Validate the request range
if bytes.Compare(req.Origin[:], req.Limit[:]) > 0 {
return nil, nil
}
// TODO(karalabe): Do we want to enforce > 0 accounts and 1 account if origin is set?
// TODO(karalabe): - Logging locally is not ideal as remote faults annoy the local user
// TODO(karalabe): - Dropping the remote peer is less flexible wrt client bugs (slow is better than non-functional)
Expand Down
Loading