From fe93473fc5a7149015e1e68027a1e6ccd5507eae Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 4 Apr 2017 10:44:53 +0200 Subject: [PATCH] getpubkey length handling - don't try to process getpubkey that is too long --- src/class_objectProcessor.py | 3 +++ src/shared.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/class_objectProcessor.py b/src/class_objectProcessor.py index e13c262c..ad78bd87 100644 --- a/src/class_objectProcessor.py +++ b/src/class_objectProcessor.py @@ -106,6 +106,9 @@ class objectProcessor(threading.Thread): 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 requestedAddressVersionNumber, addressVersionLength = decodeVarint( data[readPosition:readPosition + 10]) diff --git a/src/shared.py b/src/shared.py index 69794033..4fd66610 100644 --- a/src/shared.py +++ b/src/shared.py @@ -432,8 +432,6 @@ def _checkAndShareGetpubkeyWithPeers(data): if len(data) < 42: logger.info('getpubkey message doesn\'t contain enough data. Ignoring.') return - if len(data) > 200: - logger.info('getpubkey is abnormally long. Sanity check failed. Ignoring object.') embeddedTime, = unpack('>Q', data[8:16]) readPosition = 20 # bypass the nonce, time, and object type requestedAddressVersionNumber, addressVersionLength = decodeVarint(