mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
vcard: decode escaped chars
Since vcard message might arrive with encoded chars. To avoid crashes we properly decode any message and check for the values of interest within a fixed message format. Note: Since https://github.com/pjsip/pjproject/pull/2933, the part=/of= is not un-escaped anymore as the RFC allow escaped character. So this was an old pjproject bug and was working with luck. Change-Id: If454cecab0c7ad6867680306687fb1452dc450cd
This commit is contained in:
parent
b2256f7d18
commit
eaa52c2828
1 changed files with 11 additions and 6 deletions
|
@ -36,6 +36,8 @@
|
|||
#include <datatransfer_interface.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QUrl>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#ifdef ENABLE_LIBWRAP
|
||||
// For the debugMessageReceived connection that queues const std::string refs
|
||||
|
@ -528,15 +530,18 @@ CallbacksHandler::slotIncomingMessage(const QString& accountId,
|
|||
|
||||
for (auto& e : interaction.toStdMap()) {
|
||||
if (e.first.contains("x-ring/ring.profile.vcard")) {
|
||||
auto pieces0 = e.first.split(";");
|
||||
auto pieces1 = pieces0[1].split(",");
|
||||
auto pieces2 = pieces1[1].split("=");
|
||||
auto pieces3 = pieces1[2].split("=");
|
||||
auto decodedHead = QUrl::fromPercentEncoding(e.first.toLatin1());
|
||||
QRegularExpression re("x-ring/ring.profile.vcard;id=([A-z0-9]+),part=([0-9]+),of=([0-9]+)");
|
||||
auto match = re.match(decodedHead);
|
||||
|
||||
if (!match.hasMatch())
|
||||
continue;
|
||||
|
||||
Q_EMIT incomingVCardChunk(accountId,
|
||||
callId,
|
||||
from2,
|
||||
pieces2[1].toInt(),
|
||||
pieces3[1].toInt(),
|
||||
match.captured(2).toInt(),
|
||||
match.captured(3).toInt(),
|
||||
e.second);
|
||||
} else if (e.first.contains(
|
||||
"text/plain")) { // we consider it as an usual message interaction
|
||||
|
|
Loading…
Add table
Reference in a new issue