fixed uninitialized memory read due to not checking the result of beMsgGetNodeId() in bitdht

This commit is contained in:
csoler 2018-11-01 21:40:56 +01:00
parent 84aedb8ac7
commit 9a2bbe339a
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -1266,11 +1266,7 @@ void bdNode::recvPkt(char *msg, int len, struct sockaddr_in addr)
/************************** handle id (all) ***************************/ /************************** handle id (all) ***************************/
be_node *be_id = beMsgGetDictNode(be_data, "id"); be_node *be_id = beMsgGetDictNode(be_data, "id");
bdNodeId id; bdNodeId id;
if (be_id) if(!be_id || !beMsgGetNodeId(be_id, id))
{
beMsgGetNodeId(be_id, id);
}
else
{ {
#ifdef DEBUG_NODE_PARSE #ifdef DEBUG_NODE_PARSE
std::cerr << "bdNode::recvPkt() Missing Peer Id. Dropping Msg"; std::cerr << "bdNode::recvPkt() Missing Peer Id. Dropping Msg";