mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Fixed possible crash in ServiceControlSerialiser by checking return value of dynamic_cast.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8593 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
63d85f8077
commit
014e78dd8c
@ -188,11 +188,21 @@ public:
|
|||||||
|
|
||||||
virtual uint32_t size (RsItem *item)
|
virtual uint32_t size (RsItem *item)
|
||||||
{
|
{
|
||||||
return dynamic_cast<RsServiceControlItem *>(item)->serial_size() ;
|
RsServiceControlItem *scitem = dynamic_cast<RsServiceControlItem *>(item);
|
||||||
|
if (!scitem)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return scitem->serial_size() ;
|
||||||
}
|
}
|
||||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size)
|
virtual bool serialise(RsItem *item, void *data, uint32_t *size)
|
||||||
{
|
{
|
||||||
return dynamic_cast<RsServiceControlItem *>(item)->serialise((uint8_t*)data,*size) ;
|
RsServiceControlItem *scitem = dynamic_cast<RsServiceControlItem *>(item);
|
||||||
|
if (!scitem)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return scitem->serialise((uint8_t*)data,*size) ;
|
||||||
}
|
}
|
||||||
virtual RsItem *deserialise (void *data, uint32_t *size)
|
virtual RsItem *deserialise (void *data, uint32_t *size)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user