Skip to content

Fix #80216: imap_mail_compose() does not validate types/encodings#6323

Closed
cmb69 wants to merge 1 commit into
php:PHP-7.3from
cmb69:cmb/80216
Closed

Fix #80216: imap_mail_compose() does not validate types/encodings#6323
cmb69 wants to merge 1 commit into
php:PHP-7.3from
cmb69:cmb/80216

Conversation

@cmb69

@cmb69 cmb69 commented Oct 12, 2020

Copy link
Copy Markdown
Member

We need to check whether the given types and encodings are within
bounds 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 and body_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.

We need to check whether the given `type`s and `encoding`s are within
bounds to avoid segfaults and out-of-bound reads.
@cmb69 cmb69 added the Bug label Oct 12, 2020
@nikic

nikic commented Oct 12, 2020

Copy link
Copy Markdown
Member

This is ugly. In order to detect whether the custom types and encodings are actually supported, we have to access the global body_types and body_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.

Presumably libc-client compiles using default visibility rather than -fvisibility=hidden, so I believe those symbols should also be visible in shared libraries.

@cmb69

cmb69 commented Oct 12, 2020

Copy link
Copy Markdown
Member Author

Thanks! Then we should go with this.

@php-pulls php-pulls closed this in 73e43b6 Oct 12, 2020
@cmb69 cmb69 deleted the cmb/80216 branch October 12, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants