getpubkey length handling
- don't try to process getpubkey that is too long
This commit is contained in:
parent
c1bdcc2aba
commit
fe93473fc5
|
@ -106,6 +106,9 @@ class objectProcessor(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
def processgetpubkey(self, data):
|
def processgetpubkey(self, data):
|
||||||
|
if len(data) > 200:
|
||||||
|
logger.info('getpubkey is abnormally long. Sanity check failed. Ignoring object.')
|
||||||
|
return
|
||||||
readPosition = 20 # bypass the nonce, time, and object type
|
readPosition = 20 # bypass the nonce, time, and object type
|
||||||
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
||||||
data[readPosition:readPosition + 10])
|
data[readPosition:readPosition + 10])
|
||||||
|
|
|
@ -432,8 +432,6 @@ def _checkAndShareGetpubkeyWithPeers(data):
|
||||||
if len(data) < 42:
|
if len(data) < 42:
|
||||||
logger.info('getpubkey message doesn\'t contain enough data. Ignoring.')
|
logger.info('getpubkey message doesn\'t contain enough data. Ignoring.')
|
||||||
return
|
return
|
||||||
if len(data) > 200:
|
|
||||||
logger.info('getpubkey is abnormally long. Sanity check failed. Ignoring object.')
|
|
||||||
embeddedTime, = unpack('>Q', data[8:16])
|
embeddedTime, = unpack('>Q', data[8:16])
|
||||||
readPosition = 20 # bypass the nonce, time, and object type
|
readPosition = 20 # bypass the nonce, time, and object type
|
||||||
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
||||||
|
|
Reference in New Issue
Block a user