Merge pull request #2147 from balejk/omemo-heartbeats-fix

omemo: ignore key contents if there is no payload
This commit is contained in:
Michael Vetter
2026-04-09 14:08:06 +02:00
committed by GitHub

View File

@@ -1141,6 +1141,12 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
return NULL; return NULL;
} }
if (payload == NULL) {
signal_buffer_free(plaintext_key);
*error = OMEMO_ERR_KEY_TRANSPORT;
return NULL;
}
if (signal_buffer_len(plaintext_key) != AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH) { if (signal_buffer_len(plaintext_key) != AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH) {
log_error("[OMEMO][RECV] invalid key length"); log_error("[OMEMO][RECV] invalid key length");
signal_buffer_free(plaintext_key); signal_buffer_free(plaintext_key);
@@ -1148,12 +1154,6 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
return NULL; return NULL;
} }
if (payload == NULL) {
signal_buffer_free(plaintext_key);
*error = OMEMO_ERR_KEY_TRANSPORT;
return NULL;
}
size_t plaintext_len = payload_len; size_t plaintext_len = payload_len;
plaintext = malloc(plaintext_len + 1); plaintext = malloc(plaintext_len + 1);
res = aes128gcm_decrypt(plaintext, &plaintext_len, payload, payload_len, iv, res = aes128gcm_decrypt(plaintext, &plaintext_len, payload, payload_len, iv,