nicm / fdm

fdm source code
269 stars 50 forks source link

Garbled headers after remove-headers action #86

Open dezifit opened 3 years ago

dezifit commented 3 years ago

Using the remove-headers function leaves all multi line headers unwrapped. This affects the received lines and some other headers, which now are all written in a single line.

I'm trying to strip some X-MS-* headers (partly multi line also) before writing mails in mbox format. It seems that deliver-remove-header fails to restore the wrapping, possibly as a result of wrong offset calculation.

nicm commented 3 years ago

Am I meant to use my ESP powers to work out your fdm version and see your config and -vv output?

dezifit commented 3 years ago

It's the latest released version 2.0 (from VOID linux), see attached files. I also tested with sources compiled from git-master: same issue. header-removal-test.zip

dezifit commented 3 years ago

After some more tests and reading the code I'm sure that the issue is caused by calling set_wrapped inside the loop of headers to remove. The first call of set_wrapped works as expected, while the 2nd fails to find any multi-line headers (as they are already wrapped) - the wrap position array is empty now, which suppresses the final unwrap step.