diff options
author | George Hazan <ghazan@miranda.im> | 2020-03-18 15:31:40 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-03-18 15:31:40 +0300 |
commit | 18e00b8e27272dde88c47560130298ddf8515474 (patch) | |
tree | 09c4cc6fd84dec702cf3689f1b7543b54f13858b /protocols/JabberG | |
parent | 25d467883b6f659cd2a986ec9036d9182c9da973 (diff) |
Jabber: more correct way of processing PGP packets
Diffstat (limited to 'protocols/JabberG')
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index a026b9f113..e49e7b7bdd 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -933,14 +933,14 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz }
}
+ CMStringA szBody;
int isEncrypted, id = SerialNext();
if (!strncmp(pszSrc, PGP_PROLOG, mir_strlen(PGP_PROLOG))) {
const char *szEnd = strstr(pszSrc, PGP_EPILOG);
- char *tempstring = (char *)alloca(mir_strlen(pszSrc) + 2);
size_t nStrippedLength = mir_strlen(pszSrc) - mir_strlen(PGP_PROLOG) - (szEnd ? mir_strlen(szEnd) : 0) + 1;
- strncpy_s(tempstring, nStrippedLength, pszSrc + mir_strlen(PGP_PROLOG), _TRUNCATE);
- tempstring[nStrippedLength] = 0;
- pszSrc = tempstring;
+ szBody.Append(pszSrc + mir_strlen(PGP_PROLOG), nStrippedLength);
+ szBody.Replace("\r\n", "");
+ pszSrc = szBody;
isEncrypted = 1;
}
else isEncrypted = 0;
@@ -966,7 +966,7 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz m << XCHILD("body", pszSrc);
else {
m << XCHILD("body", "[This message is encrypted.]");
- m << XCHILDNS("x", "jabber:x:encrypted");
+ m << XCHILD("x", pszSrc) << XATTR("xmlns", "jabber:x:encrypted");
}
}
|