Skip to content

Commit

Permalink
omemo_messages without payload should be allowed to export encrypted
Browse files Browse the repository at this point in the history
An omemo_message without payload could become a KeyTransport message,
so omemo_message_export_encrypted() should not return early if only
its payload is absent. Otherwise lurch_pep_bundle_for_keytransport()
of lurch will always fail.

Signed-off-by: HardenedVault <[email protected]>
  • Loading branch information
root-hardenedvault committed Feb 10, 2021
1 parent 7667e54 commit cc1c69d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libomemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ int omemo_message_add_recipient(omemo_message * msg_p, uint32_t device_id, const
}

int omemo_message_export_encrypted(omemo_message * msg_p, int add_msg, char ** msg_xml) {
if (!msg_p || !msg_p->message_node_p || !msg_p->header_node_p || !msg_p->payload_node_p || !msg_xml) {
if (!msg_p || !msg_p->message_node_p || !msg_p->header_node_p || !msg_xml) {
return OMEMO_ERR_NULL;
}

Expand All @@ -1196,7 +1196,8 @@ int omemo_message_export_encrypted(omemo_message * msg_p, int add_msg, char ** m
mxmlElementSetAttr(encrypted_node_p, XMLNS_ATTR_NAME, OMEMO_NS);

mxmlAdd(encrypted_node_p, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, msg_p->header_node_p);
mxmlAdd(encrypted_node_p, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, msg_p->payload_node_p);
if (msg_p->payload_node_p)
mxmlAdd(encrypted_node_p, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, msg_p->payload_node_p);

if (add_msg == OMEMO_ADD_MSG_EME || add_msg == OMEMO_ADD_MSG_BOTH) {
eme_node_p = mxmlNewElement(msg_p->message_node_p, EME_NODE_NAME);
Expand Down

0 comments on commit cc1c69d

Please sign in to comment.