added a security check to avoid core dump when a bad p3discReply packet is received

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2762 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-04-22 21:32:54 +00:00
parent 890622f413
commit c4de9f0219

View File

@ -416,7 +416,9 @@ RsDiscReply *RsDiscSerialiser::deserialiseReply(void *data, uint32_t *pktsize)
memcpy(peerNetdata, (void *) (((char *) data) + offset), peerNetSize); memcpy(peerNetdata, (void *) (((char *) data) + offset), peerNetSize);
RsPeerNetItem *rsPeerNetItem = (RsPeerNetItem*)rss->deserialise(peerNetdata, &peerNetSize); RsPeerNetItem *rsPeerNetItem = (RsPeerNetItem*)rss->deserialise(peerNetdata, &peerNetSize);
offset += peerNetSize; offset += peerNetSize;
item->rsPeerList.push_back(*rsPeerNetItem);
if(rsPeerNetItem != NULL)
item->rsPeerList.push_back(*rsPeerNetItem);
} }
if (offset != rssize) { if (offset != rssize) {