1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

omemo: Check for 1 alongside true in an omemo encrypted message stanza

prekey is defined as `<xs:attribute name="prekey" type="xs:boolean"/>`
which allows both `true` and `1` as truthy values.
Not checking for `1` breaks omemo encryption when interacting with
clients which set prekey="1", example: psi+ 1.4.983
Regards https://github.com/profanity-im/profanity/issues/1247
This commit is contained in:
Sven Speckmaier 2020-01-01 20:12:26 +01:00
parent 5d7f2d1516
commit 5ccd04c91b

View File

@ -359,7 +359,9 @@ omemo_receive_message(xmpp_stanza_t *const stanza, gboolean *trusted)
key->data = g_base64_decode(key_text, &key->length);
free(key_text);
key->prekey = g_strcmp0(xmpp_stanza_get_attribute(key_stanza, "prekey"), "true") == 0;
key->prekey =
g_strcmp0(xmpp_stanza_get_attribute(key_stanza, "prekey"), "true") == 0
|| g_strcmp0(xmpp_stanza_get_attribute(key_stanza, "prekey"), "1") == 0;
keys = g_list_append(keys, key);
continue;