]> git.kaiwu.me - nginx.git/commitdiff
Mail: fixed clearing s->passwd in auth http requests.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 18 Mar 2026 12:39:37 +0000 (16:39 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Tue, 24 Mar 2026 14:46:36 +0000 (18:46 +0400)
Previously, it was not properly cleared retaining length as part of
authenticating with CRAM-MD5 and APOP methods that expect to receive
password in auth response.  This resulted in null pointer dereference
and worker process crash in subsequent auth attempts with CRAM-MD5.

Reported by Arkadi Vainbrand.

src/mail/ngx_mail_auth_http_module.c

index 4ca6d6e24dccaa886242916c2e62652951514b95..3e5095a2d226b25c50f20acffe652956200d5e76 100644 (file)
@@ -1328,7 +1328,7 @@ ngx_mail_auth_http_create_request(ngx_mail_session_t *s, ngx_pool_t *pool,
         b->last = ngx_cpymem(b->last, "Auth-Salt: ", sizeof("Auth-Salt: ") - 1);
         b->last = ngx_copy(b->last, s->salt.data, s->salt.len);
 
-        s->passwd.data = NULL;
+        ngx_str_null(&s->passwd);
     }
 
     b->last = ngx_cpymem(b->last, "Auth-Protocol: ",