From e2542a6c50ecffa0fa6bf7517a722901e9a161ca Mon Sep 17 00:00:00 2001 From: Cyril Soler Date: Mon, 7 Dec 2015 10:02:04 -0500 Subject: [PATCH] added missing check after deserialisation of grouter item which caused a crash when receiving a malformed message data --- libretroshare/src/grouter/p3grouter.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libretroshare/src/grouter/p3grouter.cc b/libretroshare/src/grouter/p3grouter.cc index 8ed41178c..cf12bfb53 100644 --- a/libretroshare/src/grouter/p3grouter.cc +++ b/libretroshare/src/grouter/p3grouter.cc @@ -510,6 +510,12 @@ void p3GRouter::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,const RsFileH RsItem *itm = RsGRouterSerialiser().deserialise(item->data_bytes,&item->data_size) ; +if(itm == NULL) +{ + std::cerr << "(EE) p3GRouter::receiveTurtleData(): cannot de-serialise data. Somthing wrong in the format. Item data (size="<< item->data_size << "): " << RsUtil::BinToHex((char*)item->data_bytes,item->data_size) << std::endl; + return ; +} + itm->PeerId(virtual_peer_id) ; // At this point we can have either a transaction chunk, or a transaction ACK.