Crash in /sub Command with Malformed JID Input #22

Closed
opened 2025-09-01 20:55:54 +00:00 by jabber.developer · 0 comments

Description

The /sub command crashes when provided with malformed JID inputs (e.g., @example.com). The issue occurs because jid_create may return a NULL pointer for invalid inputs, but cmd_sub does not check for this before proceeding.

Steps to Reproduce

  • Connect to a Jabber server.
  • In a chat window, run /sub request @example.com.
  • The application crashes due to a null pointer dereference.

Expected Behavior

Display an error message (e.g., "Malformed JID: @example.com") and continue execution.

Proposed Fix

  • Add a null check for the Jid pointer returned by jid_create
  • Display a user-friendly error message using cons_show.
  • Add unit tests to verify handling of malformed JIDs.
## Description The `/sub` command crashes when provided with malformed JID inputs (e.g., `@example.com`). The issue occurs because `jid_create` may return a `NULL` pointer for invalid inputs, but `cmd_sub` does not check for this before proceeding. ## Steps to Reproduce - Connect to a Jabber server. - In a chat window, run /sub request @example.com. - The application crashes due to a null pointer dereference. ## Expected Behavior Display an error message (e.g., "Malformed JID: @example.com") and continue execution. ## Proposed Fix - Add a null check for the `Jid` pointer returned by `jid_create` - Display a user-friendly error message using `cons_show`. - Add unit tests to verify handling of malformed JIDs.
jabber.developer self-assigned this 2025-09-01 22:23:46 +00:00
jabber.developer added the
Kind/Bug
label 2025-09-01 22:24:42 +00:00
admin closed this issue 2025-09-01 22:32:20 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devs/cproof#22
No description provided.