Re: [exim/exim] [Bug]: smtp transport outbuffer[4096] too small for XOAUTH2 AUTH commands, causes fatal "overlong write_command" (Issue #3208)

Konstantin_bx via Exim-dev <[email protected]> Mon, 23 Mar 2026 09:31:22 +0000
Newsgroups gmane.mail.exim.devel
Message-ID <exim/exim/issues/3208/comment/[email protected]>
Apologies for the missing configuration. Here is a minimal reproducer:

---------------------------------------------
Minimal configuration (authenticator section)
---------------------------------------------

xoauth_test: driver = plaintext public_name = XOAUTH2 client_send = ${authresults{xoauth2}} : :

-----------------------------------------------
Reproducer without real OAuth2 (synthetic test)
-----------------------------------------------

The issue is purely in buffer size — no real OAuth2 server is needed.
Any AUTH command exceeding 4096 bytes triggers the crash:

# Generate a test message with a fake XOAUTH2 token of 3100 bytes
# (base64-encoded > 4096 bytes, triggering the outbuffer overflow)
TOKEN = $( python3 -c "import base64; print(base64.b64encode(b'[email protected]\x01auth=Bearer ' + b'A'*3100 + b'\x01\x01').decode())" )
# Connect to any SMTP server offering AUTH XOAUTH2 and send:
#   AUTH XOAUTH2 <TOKEN>\r\n
# Exim will die before even sending the command, because the formatted
# string exceeds outblock->buffersize (4096).
Exact code path
smtp_write_command () in smtp_out.c formats the AUTH command into big_buffer ( 16384 — succeeds )
Then checks if ( gs.ptr > outblock->buffersize ) where buffersize = sizeof ( sx->outbuffer ) = 4096
Calls log_write_die () — transport process killed
The fix
In src/transports/smtp.h:

// Current ( all versions through master ) :
 uschar outbuffer [ 4096 ] ;
// Proposed:
 uschar outbuffer [ 16384 ] ;
This is not a configuration issue — it is a hardcoded buffer that is inconsistent with the incoming buffer ( SMTP_CMD_BUFFER_SIZE = 16384 ) and RFC 4954 ' s recommendation of 12288 bytes for AUTH exchanges.

---
View it on Exim Forgejo ( https://code.exim.org/exim/exim/issues/3208#issuecomment-239278 ) or reply to this email directly.

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
##   [email protected]
## Exim details at https://www.exim.org/
## Please use the Wiki with this list - https://code.exim.org/exim/wiki/wiki