Commit graph

531 commits

Author SHA1 Message Date
Christoph M. Becker
b8ff94ad23 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Properly fix #80220
2020-10-20 13:37:07 +02:00
Christoph M. Becker
486c49dee8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Properly fix #80220
2020-10-20 13:36:41 +02:00
Christoph M. Becker
9cfd650697 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Properly fix #80220
2020-10-20 13:35:06 +02:00
Christoph M. Becker
7f3bdda29b Properly fix #80220
The original fix for that bug[1] broke the formerly working composition
of message/rfc822 messages, which results in a segfault when freeing
the message body now.  While `imap_mail_compose()` does not really
support composition of meaningful message/rfc822 messages (although
libc-client appears to support that), some code may still use this to
compose partial messages, and using string manipulation to create the
final message.

The point is that libc-client expects `TYPEMESSAGE` with an explicit
subtype of `RFC822` to have a `nested.msg` (otherwise there will be a
segfault during free), but not to have any `contents.text.data` (this
will leak otherwise).

[1] <http://git.php.net/?p=php-src.git;a=commit;h=0d022ddf03c5fabaaa22e486d1e4a367ed9170a7>

Closes GH-6343.
2020-10-20 13:32:53 +02:00
Christoph M. Becker
f5b2dedc09 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix broken fix for #80239
2020-10-15 13:21:27 +02:00
Christoph M. Becker
ecd51aa099 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix broken fix for #80239
2020-10-15 13:20:58 +02:00
Christoph M. Becker
bc214c8423 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix broken fix for #80239
2020-10-15 13:19:30 +02:00
Christoph M. Becker
4b9db65f68 Fix broken fix for #80239
No idea why that `git am` failed that badly.
2020-10-15 13:18:34 +02:00
Christoph M. Becker
42d6844358 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80239: imap_rfc822_write_address() leaks memory
2020-10-15 12:58:07 +02:00
Christoph M. Becker
b7c1834c6a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80239: imap_rfc822_write_address() leaks memory
2020-10-15 12:57:35 +02:00
Christoph M. Becker
7899ac4c14 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80239: imap_rfc822_write_address() leaks memory
2020-10-15 12:56:02 +02:00
Christoph M. Becker
5941b30bb8 Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
2020-10-15 12:54:53 +02:00
Christoph M. Becker
6af54d864d Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #64076: imap_sort() does not return FALSE on failure
2020-10-13 19:41:54 +02:00
Christoph M. Becker
5aec24c477 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #64076: imap_sort() does not return FALSE on failure
2020-10-13 19:41:27 +02:00
Christoph M. Becker
d9058b61fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64076: imap_sort() does not return FALSE on failure
2020-10-13 19:38:31 +02:00
Christoph M. Becker
db8bf0a9e0 Fix #64076: imap_sort() does not return FALSE on failure
If unsupported `$search_criteria` are passed to `imap_sort()`, the
function returns an empty array, but there is also an error on the
libc-client error stack ("Unknown search criterion: UNSUPPORTED
(errflg=2)").  If, on the other hand, unsupported `$criteria` or
unsupported `$flags` are passed, the function returns `false`.  We
solve this inconsistency by returning `false` for unsupported
`$search_criteria` as well.

Closes GH-6332.
2020-10-13 19:37:05 +02:00
Christoph M. Becker
98a20acbaa Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Ignore memory leaks reported for some libc-client functions
2020-10-13 13:13:26 +02:00
Christoph M. Becker
ade146c9ed Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Ignore memory leaks reported for some libc-client functions
2020-10-13 13:12:39 +02:00
Christoph M. Becker
9c7b607320 Ignore memory leaks reported for some libc-client functions
At least on Windows, some static variables are lazily initialized
during `mail_open()` and `mail_lsub()`, which are reported as memory
leaks.  We suppress these false positives.

Closes GH-6326.
2020-10-13 13:09:29 +02:00
Christoph M. Becker
d523de69d7 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80226: imap_sort() leaks sortpgm memory
2020-10-12 23:22:19 +02:00
Christoph M. Becker
818eb8f611 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80226: imap_sort() leaks sortpgm memory
2020-10-12 23:21:56 +02:00
Christoph M. Becker
12fc8f66e7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80226: imap_sort() leaks sortpgm memory
2020-10-12 23:17:57 +02:00
Christoph M. Becker
8488c34fc6 Fix #80226: imap_sort() leaks sortpgm memory
We need to free what we have allocated.

Closes GH-6327.
2020-10-12 23:16:31 +02:00
Christoph M. Becker
51cb9b8373 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Change parameters types from int to bool
2020-10-12 23:10:41 +02:00
Christoph M. Becker
8d4774a2df Change parameters types from int to bool
These are typical boolean parameters, so we shouldn't advertize them as
integers.  For the `$reverse` parameter that even fixes expectations,
because the `reverse` member is a bitfield of 1 bit, so assigning any
even integer would not set it.

Closes GH-6328.
2020-10-12 23:10:13 +02:00
Christoph M. Becker
8e4022b461 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80216: imap_mail_compose() does not validate types/encodings
2020-10-12 16:31:03 +02:00
Christoph M. Becker
11c752a5f5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80216: imap_mail_compose() does not validate types/encodings
2020-10-12 16:30:48 +02:00
Christoph M. Becker
216d6a024a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80216: imap_mail_compose() does not validate types/encodings
2020-10-12 16:28:52 +02:00
Christoph M. Becker
73e43b6e19 Fix #80216: imap_mail_compose() does not validate types/encodings
We need to check whether the given `type`s and `encoding`s are within
bounds to avoid segfaults and out-of-bound reads.

Closes GH-6323.
2020-10-12 16:27:49 +02:00
Christoph M. Becker
2e17c937bf Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
2020-10-12 15:10:55 +02:00
Christoph M. Becker
0443c824a3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
2020-10-12 15:10:38 +02:00
Christoph M. Becker
4a469c7e98 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
2020-10-12 15:09:30 +02:00
Christoph M. Becker
c1962e900a Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
We have to clean up even on failure.

Closes GH-6322.
2020-10-12 15:08:30 +02:00
Christoph M. Becker
c3365bb301 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80220: imap_mail_compose() may leak memory
2020-10-12 13:34:42 +02:00
Christoph M. Becker
5a8958f0f3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80220: imap_mail_compose() may leak memory
2020-10-12 13:34:19 +02:00
Christoph M. Becker
acce991a37 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80220: imap_mail_compose() may leak memory
2020-10-12 13:32:40 +02:00
Christoph M. Becker
0d022ddf03 Fix #80220: imap_mail_compose() may leak memory
Unless `topbod` is of `TYPEMULTIPART`, `mail_free_body()` does not free
the `nested.part`; while we could do this ourselves, instead we just
ignore additional bodies in this case, i.e. we don't attach them in the
first place.

Closes GH-6321.
2020-10-12 13:31:30 +02:00
Christoph M. Becker
d2e5061901 Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80215: imap_mail_compose() may modify by-val parameters
2020-10-10 23:29:11 +02:00
Christoph M. Becker
6494e57804 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80215: imap_mail_compose() may modify by-val parameters
2020-10-10 23:28:19 +02:00
Christoph M. Becker
7940fb42ce Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80215: imap_mail_compose() may modify by-val parameters
2020-10-10 23:26:12 +02:00
Christoph M. Becker
62a2387a8d Fix #80215: imap_mail_compose() may modify by-val parameters
We separate the input arrays and all sub-arrays to avoid modification
of the passed parameters.

This should be rewritten to use `zend_string`s for the "master" branch.

Closes GH-6316.
2020-10-10 23:25:06 +02:00
Christoph M. Becker
e67814f67b Merge branch 'PHP-8.0' into master
* PHP-8.0:
  Fix #80213: imap_mail_compose() segfaults on certain $bodies
2020-10-10 19:20:13 +02:00
Christoph M. Becker
7d085c87ac Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80213: imap_mail_compose() segfaults on certain $bodies
2020-10-10 19:19:47 +02:00
Christoph M. Becker
b2b9e2e87e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80213: imap_mail_compose() segfaults on certain $bodies
2020-10-10 19:18:14 +02:00
Christoph M. Becker
8bee0fbd37 Fix #80213: imap_mail_compose() segfaults on certain $bodies
We have to cater to non-associative arrays where the key may be `NULL`;
we just skip these elements.

Closes GH-6315.
2020-10-10 19:17:13 +02:00
George Peter Banyard
f211f1586f Fix [-Wlogical-op] in IMAP 2020-10-10 14:45:02 +01:00
Christoph M. Becker
f5afc2c3cf Fix potential mail related segfault on Windows
`rpath` may be `NULL` here, in which case we must not access its
members.
2020-10-08 11:47:18 +02:00
George Peter Banyard
25569679aa Promote warnings to Error in IMAP extension
Drop some dependencies on argc at the same time

Closes GH-6164
2020-09-23 13:54:54 +01:00
George Peter Banyard
5d7d5e2773 Add proper default values for optional arguments in IMAP
Closes GH-6179
2020-09-22 17:46:28 +01:00
George Peter Banyard
7fde9918af Refactor imap_mail()'s internal implementation to use zend_strings 2020-09-22 17:46:28 +01:00