diff options
author | Paul Fariello <paul@fariello.eu> | 2019-05-23 13:04:51 +0200 |
---|---|---|
committer | Paul Fariello <paul@fariello.eu> | 2019-05-23 13:12:02 +0200 |
commit | 04cd1b44096b3bdda7be17e3f48f611a29e40de8 (patch) | |
tree | e3901cc17a4eb24d645287d100441952b119a374 /src/omemo | |
parent | 91d17edcb495e229c8691717069ebe989ab5e805 (diff) | |
download | profani-tty-04cd1b44096b3bdda7be17e3f48f611a29e40de8.tar.gz |
Correctly handle malformed OMEMO messages
Fix #1101
Diffstat (limited to 'src/omemo')
-rw-r--r-- | src/omemo/omemo.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index 1cf97adb..15dd162d 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -851,10 +851,14 @@ omemo_on_message_recv(const char *const from_jid, uint32_t sid, } } else { log_debug("OMEMO: decrypting message with existing session"); - signal_message *message; - signal_message_deserialize(&message, key->data, key->length, omemo_ctx.signal); - res = session_cipher_decrypt_signal_message(cipher, message, NULL, &plaintext_key); - SIGNAL_UNREF(message); + signal_message *message = NULL; + res = signal_message_deserialize(&message, key->data, key->length, omemo_ctx.signal); + if (res < 0) { + log_error("OMEMO: cannot deserialize message"); + } else { + res = session_cipher_decrypt_signal_message(cipher, message, NULL, &plaintext_key); + SIGNAL_UNREF(message); + } } session_cipher_free(cipher); |