Repository navigation
Improve cleaning of messages - #2217
Merged
Merged
Conversation
When a MUC or private message contained \u200E (LRM) or \u200F (RLM), _cut() freed message->plain and allocated a new string. Callers saved old_plain and restored it after running plugin hooks. This left message->plain pointing to already freed memory, which caused a crash with double free when message_free() was called. Now we clean the directional characters in-place without reallocating or freeing the string. Fixes: #2210 Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Now we also filter: * Arabic Letter Mark (U+061C) * Embeddings and overrides (U+202A to U+202E) * Isolates (U+2066 to U+2069) Signed-off-by: Michael Vetter <jubalh@iodoru.org>
In plain XMPP and OMEMO, XML 1.0 already rejects most C0 control characters. However, terminal escape sequences can still reach the message buffer in several situations: * OTR and legacy PGP decrypt raw bytes directly into the message buffer without passing through an XML parser. * XML 1.0 allows entity-encoded carriage return (
 / \r), which in a terminal can overwrite preceding text on the current line. * XML 1.0 allows DEL (0x7F) and C1 controls (U+0080 to U+009F), where U+009B acts as an 8-bit escape introducer (CSI) in many terminals. Preserve legitimate \t and \n whitespace characters. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Extract the common string traversal and in-place compacting logic from str_clean_directional_chars() and str_clean_terminal_control_chars() into a shared static helper _str_clean_chars(). Each cleaner now defines a small filter function and passes it to the shared helper. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Member
Author
|
Reviewers welcome |
Replace the \u0080, \u009B, and \u009F UCNs with their corresponding UTF-8 hex byte sequences (\xc2\x80, \xc2\x9b, \xc2\x9f) to make clang happy. Signed-off-by: Michael Vetter <jubalh@iodoru.org>
jubalh
force-pushed
the
fix/2210-clean-msgs
branch
from
October 11, 2026 07:36
6af9c9c to
05272f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.