From cef193c7397ddf4919d136e7e2f20593e0190e1f Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 1 Nov 2018 21:40:56 +0100 Subject: [PATCH] fixed uninitialized memory read due to not checking the result of beMsgGetNodeId() in bitdht --- src/bitdht/bdnode.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/bitdht/bdnode.cc b/src/bitdht/bdnode.cc index aec11fe..9adaaea 100644 --- a/src/bitdht/bdnode.cc +++ b/src/bitdht/bdnode.cc @@ -1266,11 +1266,7 @@ void bdNode::recvPkt(char *msg, int len, struct sockaddr_in addr) /************************** handle id (all) ***************************/ be_node *be_id = beMsgGetDictNode(be_data, "id"); bdNodeId id; - if (be_id) - { - beMsgGetNodeId(be_id, id); - } - else + if(!be_id || !beMsgGetNodeId(be_id, id)) { #ifdef DEBUG_NODE_PARSE std::cerr << "bdNode::recvPkt() Missing Peer Id. Dropping Msg";