]> git.kaiwu.me - nginx.git/commit
SSL: explicitly clear the session staging buffer
authorAndrew Clayton <a.clayton@nginx.com>
Tue, 29 Sep 2026 20:36:48 +0000 (21:36 +0100)
committerAndrew Clayton <a.clayton@nginx.com>
Tue, 27 Oct 2026 16:51:17 +0000 (16:51 +0000)
commit797c039a9884f69aae96286dcdf1ba633e5ebf81
tree24dbbd83070f8d93abed13a9ce0d044d0a286cd9
parent9a7439fd79076de03c408de136ba1772347030c2
SSL: explicitly clear the session staging buffer

Since 3d7304b52, sessions are serialized into the static buffer
ngx_ssl_session_buffer, so the last cached, resumed, or proxied session
remains in memory, master secret included, until overwritten. Clear the
buffer on all exits that write to it.

While here, the session id length check is moved before serialization,
which removes an exit path with a populated buffer and a needless
i2d_SSL_SESSION() call for sessions that are not cached.

Note that sessions are still kept in shared memory until evicted.

Assisted-by: opencode:claude-opus-5
Closes: https://github.com/nginx/nginx/issues/1736
src/event/ngx_event_openssl.c
src/http/ngx_http_upstream_round_robin.c
src/stream/ngx_stream_upstream_round_robin.c