From: Anuj Date: Thu, 26 Nov 2026 14:05:31 +0000 (+0000) Subject: SSL: workaround for SSL_get_negotiated_group() with no session X-Git-Url: https://git.kaiwu.me/http/ngx_http_fastcgi_module.html?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=nginx.git SSL: workaround for SSL_get_negotiated_group() with no session OpenSSL prior to 3.5.0 dereferences a NULL session pointer in SSL_get_negotiated_group() when called on a connection where no session is established yet, fixed in this commit: https://github.com/openssl/openssl/commit/4ca80d3941 Supported OpenSSL versions are not affected, but the workaround is applied for older OpenSSL versions we keep compatibility with. The fix is to check for the session explicitly. --- diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 27635855c..bcd026c1b 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -5776,6 +5776,15 @@ ngx_ssl_get_curve(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s) int nid; const char *name; +#if (OPENSSL_VERSION_NUMBER < 0x30500000L) + + if (SSL_get0_session(c->ssl->connection) == NULL) { + s->len = 0; + return NGX_OK; + } + +#endif + nid = SSL_get_negotiated_group(c->ssl->connection); if (nid != NID_undef) {