]> git.kaiwu.me - nginx.git/commit
Mail: updated ngx_mail_send() to set handlers on s->quit.
authorMaxim Dounin <mdounin@mdounin.ru>
Sat, 20 Jun 2026 02:04:41 +0000 (05:04 +0300)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Wed, 11 Nov 2026 12:17:01 +0000 (16:17 +0400)
commite505109a3f21074bf0414eb8241a37085d2da8cb
tree9289d1eadbd4d4fbc68afa74589451038b11e9cb
parente27f5fa84fe6e98505e70bc543b748747dad0a3b
Mail: updated ngx_mail_send() to set handlers on s->quit.

Most notably, this fixes potential issues when a fatal error message is
sent with ngx_mail_send() with s->quit set, but the read handler is not
updated.  Despite s->quit, ngx_mail_send() might not be able to send the
error message immediately, and the read handler might be called on read
events.  In particular, in ngx_mail_auth_http_block_read() and in
ngx_mail_proxy_block_read() this could potentially cause accesses to
freed memory or already closed connections in ngx_handle_read_event()
error handling code paths.

Reported by Evan Hellman,
https://github.com/freenginx/nginx/issues/23
https://github.com/freenginx/nginx/issues/24

Signed-off-by: Vadim Zhestikov <v.zhestikov@f5.com>
Origin: <https://freenginx.org/hg/nginx/rev/87725983f346>
src/mail/ngx_mail_handler.c