Commit bff7054a authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin

sip: check message utf8 validity before emitting signal

Change-Id: Ib269664e650a0b578fe15eb935d92700d605d821
Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent 93ced3b4
......@@ -41,6 +41,7 @@
#include "string_utils.h"
#include "fileutils.h"
#include "sip_utils.h"
#include "utf8_utils.h"
#include <ctime>
#include <type_traits>
......@@ -385,7 +386,15 @@ void
SIPAccountBase::onTextMessage(const std::string& from,
const std::map<std::string, std::string>& payloads)
{
JAMI_DBG("Text message received from %s, %zu part(s)", from.c_str(), payloads.size());
JAMI_DBG("Text message received from %s, %zu part(s)", from.c_str(), payloads.size());
for (const auto& m : payloads) {
if (!utf8_validate(m.first))
return;
if (!utf8_validate(m.second)) {
JAMI_WARN("Dropping invalid message with MIME type %s", m.first.c_str());
return;
}
}
emitSignal<DRing::ConfigurationSignal::IncomingAccountMessage>(accountID_, from, payloads);
DRing::Message message;
message.from = from;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment