You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cherry-pick upstream mailcore2 bug fixes and improvements (#16)
* Cherry-pick upstream mailcore2 bug fixes and improvements
Cherry-picked the following commits from upstream MailCore/mailcore2:
1. fad23d73 - Ensure checking SSL Certificate in IMAP StartTLS
Security fix: adds certificate validation after StartTLS connection
to close a potential security gap where certificate validation
wasn't being performed in that connection mode.
2. cccebc79 - Fix IMAPMessagesRequestKindFullHeaders handling (#1947)
Bug fix: properly handles the FullHeaders flag when fetching
messages by UID, fetching complete headers when the flag is set.
3. 29f9488a - Add IMAPMessagesRequestKindAllHeaders flag
New feature: adds a new flag to fetch all non-parsed headers,
unlike FullHeaders which fetches a limited set.
These are the only relevant commits since v0.6.4 (Aug 2020) through
Nov 2022 that are bug fixes or functionality improvements for the
C++ core. Excluded: Swift/SPM changes, Android changes, Obj-C specific
fixes, documentation updates, and Xcode project changes.
* Cherry-pick upstream libetpan bug fixes and security patches
This commit cherry-picks 8 critical bug fixes and security patches from
upstream libetpan (versions 1.9.2-1.9.4) to the vendored libetpan 1.9.1.
Patches Applied:
1. CVE-2022-4121 Fix (commit 5c9eb6b)
- Fixed crash when st_info_list is NULL in mailimap_mailbox_data_status_free
- Prevents NULL pointer dereference vulnerability
- File: src/low-level/imap/mailimap_types.c
2. STARTTLS Response Injection Protection - IMAP (commit 1002a01)
- Detects extra data after STARTTLS response to prevent response injection attacks
- Returns MAILIMAP_ERROR_STARTTLS if extra data is detected
- File: src/low-level/imap/mailimap.c
3. STARTTLS Response Injection Protection - SMTP/POP3 (commit 298460a)
- Same protection for SMTP and POP3 protocols
- Files: src/low-level/smtp/mailsmtp.c, src/low-level/pop3/mailpop3.c
4. Quota SIGSEGV Fix (commit 180b37a)
- Fixed SIGSEGV in mailimap_quota_getquotaroot
- Properly passes parser context to parser functions instead of NULL
- File: src/low-level/imap/quota_parser.c
5. TLS Timeout Fix for GnuTLS (commit 4aee224)
- Fixed timeout values for gnutls_handshake_set_timeout (ms vs seconds)
- Prevents 1000x shorter timeouts than requested on GnuTLS platforms
- File: src/data-types/mailstream_ssl.c
6. IMAP Logout Return Code Fix (commit 27d6f41)
- Fixed incorrect error handling when server closes connection after BYE
- MAILIMAP_ERROR_STREAM is now expected and treated as success
- File: src/low-level/imap/mailimap.c
7. MIME Field Location Handler (commit b4088cb)
- Added missing handler for MAILMIME_FIELD_LOCATION in mailmime_write()
- File: src/low-level/mime/mailmime_write_generic.c
8. snprintf() Output Fix (commit 1fef3a0)
- Fixed incorrect snprintf() usage in test file
- File: tests/frm-simple.c
Patches Already Included (in commit 01656c8 from Aug 2022):
- Buffer overwrite fix for empty strings (commit 078b924)
- Memory leak fix in mailimap_hack_date_time_parse (commit 5b43488)
- Proper realloc() usage fix (commit 92f8b23)
- Resent-Bcc header parsing fix (commit 79eefd5)
Patches Excluded:
- Platform-specific commits (iOS/macOS/Android build fixes)
- Build system changes (pkg-config, configure.ac)
- Documentation-only changes
- Reverted commits from upstream
- Features not present in libetpan 1.9.1 (e.g., clientid, TLS SNI)
Analysis Summary:
- Base vendored version: libetpan 1.9.1
- Upstream versions analyzed: 1.9.2, 1.9.3, 1.9.4
- Total commits reviewed: ~100 commits since 1.9.1
- Security fixes applied: 3 (CVE-2022-4121, 2x STARTTLS)
- Bug fixes applied: 5
- Files modified: 8 files, 89 insertions, 24 deletions
This update brings important security fixes and stability improvements to
the email sync engine while maintaining compatibility with the existing
codebase.
* Add vendor library update workflow documentation
Documents the process for cherry-picking upstream bug fixes and
improvements into vendored dependencies (mailcore2, libetpan) while
preserving local modifications.
Includes:
- Step-by-step workflow
- Commit categorization guidelines
- Example from mailcore2 update
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments