packets: limit chain locators.
This commit is contained in:
parent
00f24dc11e
commit
e32f521a43
@ -977,6 +977,8 @@ GetBlocksPacket.prototype.getSize = function getSize() {
|
|||||||
GetBlocksPacket.prototype.toWriter = function toWriter(bw) {
|
GetBlocksPacket.prototype.toWriter = function toWriter(bw) {
|
||||||
var i;
|
var i;
|
||||||
|
|
||||||
|
assert(this.locator.length <= 50000, 'Too many block hashes.');
|
||||||
|
|
||||||
bw.writeU32(this.version);
|
bw.writeU32(this.version);
|
||||||
bw.writeVarint(this.locator.length);
|
bw.writeVarint(this.locator.length);
|
||||||
|
|
||||||
@ -1011,6 +1013,8 @@ GetBlocksPacket.prototype.fromReader = function fromReader(br) {
|
|||||||
|
|
||||||
count = br.readVarint();
|
count = br.readVarint();
|
||||||
|
|
||||||
|
assert(count <= 50000, 'Too many block hashes.');
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
this.locator.push(br.readHash('hex'));
|
this.locator.push(br.readHash('hex'));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user