An IMAP FETCH response line indicates the size of the returned data, in number of bytes. When that response says the data is zero bytes, libcurl would pass on that (non-existing) data with a pointer and the size (zero) to the deliver-data function. libcurl's deliver-data function treats zero as a magic number and invokes strlen() on the data to figure out the length. The strlen() is called on a heap based buffer that might not be zero terminated so libcurl might read beyond the end of it into whatever memory lies after (or just crash) and then deliver that to the application as if it was actually downloaded. Introduced with: https://github.com/curl/curl/commit/ec3bb8f727 External References: https://curl.haxx.se/docs/adv_20171023.html
Mitigation: Switch off IMAP in `CURLOPT_PROTOCOLS`
Acknowledgments: Name: the Curl project Upstream: Brian Carpenter, the OSS-Fuzz project
Created curl tracking bugs for this issue: Affects: fedora-all [bug 1505233] Created mingw-curl tracking bugs for this issue: Affects: epel-7 [bug 1505232] Affects: fedora-all [bug 1505234]
Upstream commit: https://github.com/curl/curl/commit/13c9a9ded3ae744a1e11cbc14e9146d9fa427040 OSS-Fuzz issue for this problem: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3586
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2017:3263 https://access.redhat.com/errata/RHSA-2017:3263
This issue has been addressed in the following products: Red Hat JBoss Core Services Via RHSA-2018:2486 https://access.redhat.com/errata/RHSA-2018:2486
This issue has been addressed in the following products: Red Hat Software Collections for Red Hat Enterprise Linux 6 Red Hat Software Collections for Red Hat Enterprise Linux 7 Red Hat Software Collections for Red Hat Enterprise Linux 7.4 EUS Red Hat Software Collections for Red Hat Enterprise Linux 7.5 EUS Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS Via RHSA-2018:3558 https://access.redhat.com/errata/RHSA-2018:3558