pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
681 stars 162 forks source link

Properly sanitize control chars in subject/headers/body #1646

Open lfos opened 4 months ago

lfos commented 4 months ago

I recently noticed that some messages (primarily spam) contain control characters that result in garbled output in both the search widget and the thread view. This PR addresses this by

  1. removing all unwanted control characters (and not just CR) from strings before outputting and
  2. applying string_sanitize() to subjects in the search widget.
lucc commented 4 months ago

Can we have a test email for this?

lfos commented 4 months ago

@lucc To manually reproduce, just take a random email and append U+009d to the subject line; other control characters work too. Note that the exact result may also depend on the terminal you're using; I'm using kitty to reproduce the garbled output. I also added a test case to the commit.