diff --git a/libretroshare/src/serialiser/rsserializer.cc b/libretroshare/src/serialiser/rsserializer.cc index e59b7d9fd..1a029ee2e 100644 --- a/libretroshare/src/serialiser/rsserializer.cc +++ b/libretroshare/src/serialiser/rsserializer.cc @@ -33,11 +33,16 @@ RsItem *RsServiceSerializer::deserialise(void *data, uint32_t *size) { - if(!data || !size || !*size) + if(!data || !size || *size < 8) { - RsErr() << __PRETTY_FUNCTION__ << " Called with null paramethers data: " - << data << " size: " << static_cast(size) << " *size: " - << (size ? *size : 0) << " this should never happen!" + RsErr() << __PRETTY_FUNCTION__ << " Called with inconsistent parameters data: " << std::endl; + if(data) + RsErr() << "Data is: " << RsUtil::BinToHex(static_cast(data),std::min(50u,*size)) << ((*size>50)?"...":"") << std::endl; + else + RsErr() << "Null Data" << std::endl; + + RsErr() << " size: " << static_cast(size) << " *size: " << (size ? *size : 0) << std::endl + << " this should never happen!" << std::endl; print_stacktrace(); return nullptr;