From 5ccd04c91bbc4ed4e32fdc4513c1a7a58918e513 Mon Sep 17 00:00:00 2001 From: Sven Speckmaier Date: Wed, 1 Jan 2020 20:12:26 +0100 Subject: [PATCH] omemo: Check for `1` alongside `true` in an omemo encrypted message stanza prekey is defined as `` 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 --- src/xmpp/omemo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c index 22935c0d..ba373c4f 100644 --- a/src/xmpp/omemo.c +++ b/src/xmpp/omemo.c @@ -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;