fix(xmpp): guard NULL domain in autoping disco warning gate #138

Manually merged
jabber.developer2 merged 1 commits from fix/autoping-warning-null-domain into master 2026-06-23 12:31:56 +00:00
Collaborator

Follow-up to the autoping availability warning.

The disco-onconnect gate uses g_ascii_strcasecmp(from, connection_get_domain()), which is not NULL-safe (unlike the g_strcmp0 it replaced). connection_get_domain() can return NULL (initialised to NULL, FREE_SET_NULL on teardown), so a disco#info response racing a disconnect could dereference NULL.

Capture the domain into a local and skip the check when it's NULL:

const char* domain = connection_get_domain();
if (from && domain && g_ascii_strcasecmp(from, domain) == 0) { ... }

from is already guarded; this just adds the domain side.

Follow-up to the autoping availability warning. The disco-onconnect gate uses `g_ascii_strcasecmp(from, connection_get_domain())`, which is not NULL-safe (unlike the `g_strcmp0` it replaced). `connection_get_domain()` can return NULL (initialised to NULL, `FREE_SET_NULL` on teardown), so a disco#info response racing a disconnect could dereference NULL. Capture the domain into a local and skip the check when it's NULL: const char* domain = connection_get_domain(); if (from && domain && g_ascii_strcasecmp(from, domain) == 0) { ... } `from` is already guarded; this just adds the domain side.
jabber.developer2 added 1 commit 2026-06-23 11:25:22 +00:00
fix(xmpp): guard NULL domain in autoping disco warning gate
Some checks failed
CI Code / Check coding style (pull_request) Successful in 29s
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Linux (debian) (pull_request) Successful in 5m16s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m25s
CI Code / Linux (arch) (pull_request) Successful in 7m37s
CI Code / Code Coverage (pull_request) Successful in 7m59s
CI Code / Check spelling (push) Successful in 15s
CI Code / Check coding style (push) Successful in 33s
CI Code / Linux (ubuntu) (push) Has been cancelled
CI Code / Code Coverage (push) Has been cancelled
CI Code / Linux (debian) (push) Has been cancelled
CI Code / Linux (arch) (push) Has been cancelled
15dfc2bdb4
g_ascii_strcasecmp() is not NULL-safe (unlike the g_strcmp0 it replaced), and connection_get_domain() can be NULL (init NULL, FREE_SET_NULL on teardown). A disco#info response racing a disconnect would dereference NULL. Capture the domain and skip the check when it is NULL.
jabber.developer2 manually merged commit 15dfc2bdb4 into master 2026-06-23 12:31:56 +00:00
jabber.developer reviewed 2026-06-23 12:32:05 +00:00
jabber.developer left a comment
Owner

LGTM

LGTM
Sign in to join this conversation.
No description provided.