From b55d37efa4572af83a07b407d98729e5dc17fb48 Mon Sep 17 00:00:00 2001 From: b1rdG Date: Thu, 23 Apr 2020 14:56:53 -0500 Subject: [PATCH 1/2] Add RsGxsId checks --- libretroshare/src/chat/p3chatservice.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 9775f54de..9cc9ce832 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -722,6 +722,23 @@ bool p3ChatService::initiateDistantChatConnexion( const RsGxsId& to_gxs_id, uint32_t& error_code, bool notify ) { + + if(to_gxs_id.isNull()) + { + RsErr() << __PRETTY_FUNCTION__ << " Destination RsGxsId is invalid" << std::endl; + return false; + } + if (from_gxs_id.isNull()) + { + RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId is invalid" << std::endl; + return false; + } + if (!rsIdentity->isOwnId(from_gxs_id)) + { + RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId id must be own" << std::endl; + return false; + } + if(DistantChatService::initiateDistantChatConnexion( to_gxs_id, from_gxs_id, pid, error_code, notify )) From 36bab55d8c8cd87b6128f59e3e235c1f945d3fa5 Mon Sep 17 00:00:00 2001 From: b1rdG Date: Thu, 23 Apr 2020 15:15:03 -0500 Subject: [PATCH 2/2] Use tabs instead of spaces --- libretroshare/src/chat/p3chatservice.cc | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/chat/p3chatservice.cc b/libretroshare/src/chat/p3chatservice.cc index 9cc9ce832..3fbbdaf75 100644 --- a/libretroshare/src/chat/p3chatservice.cc +++ b/libretroshare/src/chat/p3chatservice.cc @@ -723,21 +723,21 @@ bool p3ChatService::initiateDistantChatConnexion( const RsGxsId& to_gxs_id, bool notify ) { - if(to_gxs_id.isNull()) - { - RsErr() << __PRETTY_FUNCTION__ << " Destination RsGxsId is invalid" << std::endl; - return false; - } - if (from_gxs_id.isNull()) - { - RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId is invalid" << std::endl; - return false; - } - if (!rsIdentity->isOwnId(from_gxs_id)) - { - RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId id must be own" << std::endl; - return false; - } + if(to_gxs_id.isNull()) + { + RsErr() << __PRETTY_FUNCTION__ << " Destination RsGxsId is invalid" << std::endl; + return false; + } + if (from_gxs_id.isNull()) + { + RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId is invalid" << std::endl; + return false; + } + if (!rsIdentity->isOwnId(from_gxs_id)) + { + RsErr() << __PRETTY_FUNCTION__ << " Origin RsGxsId id must be own" << std::endl; + return false; + } if(DistantChatService::initiateDistantChatConnexion( to_gxs_id, from_gxs_id, pid,