From 9484ca1663bacee0989fcf9d10545ae7cefa02ac Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 27 Feb 2011 19:54:13 +0000 Subject: [PATCH] fixed soem other potential SIGSEGVs git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4065 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- src/bitdht/bdmsgs.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bitdht/bdmsgs.cc b/src/bitdht/bdmsgs.cc index 6f1f7f4..1e2b218 100644 --- a/src/bitdht/bdmsgs.cc +++ b/src/bitdht/bdmsgs.cc @@ -543,7 +543,10 @@ uint32_t beMsgType(be_node *n) #ifdef DEBUG_MSG_TYPE std::cerr << "bsMsgType() QUERY MSG TYPE" << std::endl; #endif - be_node *query = beMsgGetDictNode(n, "q"); + be_node *query = beMsgGetDictNode(n, "q"); + + if(query == NULL) + return BITDHT_MSG_TYPE_UNKNOWN; if (beMsgMatchString(query, "ping", 4)) { @@ -804,11 +807,11 @@ int beMsgGetListStrings(be_node *n, std::list &values) for(int i = 0; n->val.l[i] != NULL; i++) { be_node *val = n->val.l[i]; - if (val->type != BE_STR) - { + + if (val == NULL || val->type != BE_STR) return 0; - } - int len = be_str_len(val); + + int len = be_str_len(val); std::string str; str.append(val->val.s, len); values.push_back(str);