about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-03-25 15:37:54 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-25 15:37:54 +0100
commit099260a4e3bf0eddbf9375ba58a9bfc78287b754 (patch)
tree40817f0b12067fabbeae5ea1bb5ce8b8374686ca /src
parent22362424074db089e07bf823c9bbd5d54eed55ed (diff)
downloadprofani-tty-099260a4e3bf0eddbf9375ba58a9bfc78287b754.tar.gz
message: make _handle_receipt_received safer
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/message.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 3cb56c96..1303b38b 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -1142,7 +1142,7 @@ _handle_receipt_received(xmpp_stanza_t* const stanza)
     xmpp_stanza_t* receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
     if (receipt) {
         const char* name = xmpp_stanza_get_name(receipt);
-        if (g_strcmp0(name, "received") != 0) {
+        if ((name == NULL) || (g_strcmp0(name, "received") != 0)) {
             return;
         }
 
@@ -1157,6 +1157,10 @@ _handle_receipt_received(xmpp_stanza_t* const stanza)
         }
 
         Jid* jidp = jid_create(fulljid);
+        if(!jidp) {
+            return;
+        }
+
         sv_ev_message_receipt(jidp->barejid, id);
         jid_destroy(jidp);
     }