mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 04:16:21 +00:00
fix(cmd_sub): Prevent crash with malformed JID in /sub command
Added null check for jidp in cmd_sub to handle jid_create returning NULL. Crash occurred when processing malformed JID inputs like @example.com. Ensures robust handling of invalid JIDs. Fixes #22
This commit is contained in:
@@ -1263,6 +1263,11 @@ cmd_sub(ProfWin* window, const char* const command, gchar** args)
|
||||
|
||||
auto_jid Jid* jidp = jid_create(jid);
|
||||
|
||||
if (jidp == NULL) {
|
||||
cons_show("Malformed JID: %s", jid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "allow") == 0) {
|
||||
presence_subscription(jidp->barejid, PRESENCE_SUBSCRIBED);
|
||||
cons_show("Accepted subscription for %s", jidp->barejid);
|
||||
|
||||
Reference in New Issue
Block a user