From 51d2355d9704c305095f4baa2c8a25d9e63d76f3 Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Mon, 1 Sep 2025 21:28:19 +0200 Subject: [PATCH] fix(cmd_caps): Prevent crash in /caps with malformed JID input - Added null check for `jid` in `cmd_caps` to handle `jid_create` returning NULL. - Crash occurred when processing malformed inputs like `@example.com` in `/caps`. - Ensures robust handling of invalid JID strings in `WIN_CHAT` and `WIN_CONSOLE` cases. Fixes #20 --- src/command/cmd_funcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index e1ac8d37..bcc6b85c 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -3418,7 +3418,7 @@ cmd_caps(ProfWin* window, const char* const command, gchar** args) if (args[0]) { auto_jid Jid* jid = jid_create(args[0]); - if (jid->fulljid == NULL) { + if (jid == NULL || jid->fulljid == NULL) { cons_show("You must provide a full jid to the /caps command."); } else { PContact pcontact = roster_get_contact(jid->barejid); -- 2.49.1