We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed6ac2f commit d00f7d7Copy full SHA for d00f7d7
xmpp.c
@@ -541,12 +541,15 @@ void xmpp_connect()
541
connection_state = OFFLINE;
542
return;
543
}
544
- char *jid = malloc(3071); // see rfc3920bis
545
- strcpy(jid, g_hash_table_lookup(config, "username"));
+
+ // see rfc3920
546
+#define MAX_JID_COMPONENT_LEN 1023
547
+#define MAX_JID_LEN (MAX_JID_COMPONENT_LEN * 3 + 2)
548
+ char jid[MAX_JID_LEN + 1];
549
+ strncpy(jid, g_hash_table_lookup(config, "username"), MAX_JID_COMPONENT_LEN);
550
strcat(jid, "@");
551
strcat(jid, lm_connection_get_server(connection));
552
lm_connection_set_jid(connection, jid); // loudmouth doesn't set it itself somewhy
- free(jid);
553
554
lm_connection_set_keep_alive_rate(connection, 240);
555
0 commit comments