From c4de9f021983b991e3604b33c00fd71d5388edd5 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 22 Apr 2010 21:32:54 +0000 Subject: [PATCH] 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 --- libretroshare/src/serialiser/rsdiscitems.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/serialiser/rsdiscitems.cc b/libretroshare/src/serialiser/rsdiscitems.cc index 2f4773f95..6d5f9d83f 100644 --- a/libretroshare/src/serialiser/rsdiscitems.cc +++ b/libretroshare/src/serialiser/rsdiscitems.cc @@ -416,7 +416,9 @@ RsDiscReply *RsDiscSerialiser::deserialiseReply(void *data, uint32_t *pktsize) memcpy(peerNetdata, (void *) (((char *) data) + offset), peerNetSize); RsPeerNetItem *rsPeerNetItem = (RsPeerNetItem*)rss->deserialise(peerNetdata, &peerNetSize); offset += peerNetSize; - item->rsPeerList.push_back(*rsPeerNetItem); + + if(rsPeerNetItem != NULL) + item->rsPeerList.push_back(*rsPeerNetItem); } if (offset != rssize) {