fix: Incorrect omemo decryption error for Key Transport Messages

Correctly handle OMEMO stanzas that contain a <header> but no <payload>.
These "Key Transport Messages" (heartbeats) are used by some clients
for session maintenance and establishing trust.

Ref: a2726b6a7 made the <payload> element mandatory in the parser.
Ref: 4d49c2b74 the bug became user-visible.

Fixes: https://github.com/profanity-im/profanity/issues/2129
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
Michael Vetter
2026-03-22 17:14:24 +01:00
parent a85a33e397
commit e4bfda2f8a
4 changed files with 26 additions and 14 deletions

View File

@@ -1145,6 +1145,11 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
return NULL;
}
if (payload == NULL) {
signal_buffer_free(plaintext_key);
return NULL;
}
size_t plaintext_len = payload_len;
plaintext = malloc(plaintext_len + 1);
res = aes128gcm_decrypt(plaintext, &plaintext_len, payload, payload_len, iv,