feat: Sanitize illegal XML characters from outgoing messages

Filter out control characters (U+0000 to U+001F) from outgoing
messages, as they are illegal in XML 1.0 (except for \t, \n, and \r).
This prevents XMPP servers from closing the connection when such
characters are accidentally or intentionally included in a message.

Fixes: https://github.com/profanity-im/profanity/issues/1437
This commit is contained in:
Michael Vetter
2026-03-19 09:40:44 +01:00
parent 9de455ceea
commit 189050f3f4
6 changed files with 68 additions and 3 deletions

View File

@@ -661,6 +661,7 @@ main(int argc, char* argv[])
cmocka_unit_test(prof_occurrences__tests__large_message),
cmocka_unit_test(get_mentions__tests__various),
cmocka_unit_test(release_is_new__tests__various),
cmocka_unit_test(str_xml_sanitize__strips_illegal_characters),
cmocka_unit_test_setup_teardown(plugins_get_command_names__returns__no_commands,
load_preferences,