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:26:16 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-25 15:26:16 +0100
commitb1bd1ecca8d7cad4423cebead6f2d1f57b6adb33 (patch)
treed600bf217cf12142261946b0531b50fca844cfdb /src
parent11382a8bf3de97b7f59a1662862a13c76f48c6e6 (diff)
downloadprofani-tty-b1bd1ecca8d7cad4423cebead6f2d1f57b6adb33.tar.gz
message: make _message_handler safer
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/message.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index f3e81794..1f43389e 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -226,13 +226,15 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
             char* mybarejid = connection_get_barejid();
             const char* const stanza_from = xmpp_stanza_get_from(stanza);
 
-            if (g_strcmp0(mybarejid, stanza_from) != 0) {
-                log_warning("Invalid carbon received, from: %s", stanza_from);
-                msg_stanza = NULL;
-            } else {
-                is_carbon = TRUE;
-                // returns NULL if it was a carbon that was invalid, so that we dont parse later
-                msg_stanza = _handle_carbons(carbons);
+            if (stanza_from) {
+                if (g_strcmp0(mybarejid, stanza_from) != 0) {
+                    log_warning("Invalid carbon received, from: %s", stanza_from);
+                    msg_stanza = NULL;
+                } else {
+                    is_carbon = TRUE;
+                    // returns NULL if it was a carbon that was invalid, so that we dont parse later
+                    msg_stanza = _handle_carbons(carbons);
+                }
             }
 
             free(mybarejid);