fix(xmpp): treat disco#info result without 'from' as from the server #170
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/disco-info-null-from"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #168
RFC 6120 §8.1.2.1: a stanza received over a c2s stream without a from attribute must be treated as coming from the server itself. The on-connect disco#info handler passed the absent attribute as NULL into connection_features_received(), where g_str_hash() dereferenced the NULL key and crashed — a remotely triggerable DoS on connect.
Substitute connection_get_domain() for a missing from in both disco#info response handlers (src/xmpp/iq.c).
Defense in depth: make connection_features_received() and connection_get_features() NULL-safe (src/xmpp/connection.c).
Regression test: disco_info_result_no_from answers the on-connect disco#info with a from-less result via stabber; before the fix this crashed the client during login.
a283c4e7b4toc9455d27bac9455d27bato2c8bd867b9LGTM
f2918f5aaftod914e42ff6