Fix #80216: imap_mail_compose() does not validate types/encodings #6323
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.
We need to check whether the given
type
s andencoding
s are withinbounds to avoid segfaults and out-of-bound reads.
This is ugly. In order to detect whether the custom types and encodings are actually supported, we have to access the global
body_types
andbody_encodings
which are declared in mail.h, but not be exported. There is no issue on Windows, because libc-client is linked statically (at least with the official dependencies), but otherwise this patch may not even build.