SSL: workaround for i2d_SSL_SESSION() negative values

i2d_SSL_SESSION() may unexpectedly return a negative value on
memory allocation failure, even though the NULL buffer was passed,
notably in LibreSSL.

Reported by szzzy.
This commit is contained in:
Vadim Zhestikov authored and VadimZhestikov committed 2026-10-15 08:15:52 -07:00
1 parent e72a6a0bc3
commit faf9438989
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -4462,7 +4462,7 @@ ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn, ngx_ssl_session_t *sess)
/* do not cache too big session */
if (len > NGX_SSL_MAX_SESSION_SIZE) {
if (len <= 0 || len > NGX_SSL_MAX_SESSION_SIZE) {
return 0;
}
+1 -1
View File
@@ -1196,7 +1196,7 @@ ngx_http_upstream_save_round_robin_peer_session(ngx_peer_connection_t *pc,
/* do not cache too big session */
if (len > NGX_SSL_MAX_SESSION_SIZE) {
if (len <= 0 || len > NGX_SSL_MAX_SESSION_SIZE) {
return;
}
+1 -1
View File
@@ -1027,7 +1027,7 @@ ngx_stream_upstream_save_round_robin_peer_session(ngx_peer_connection_t *pc,
/* do not cache too big session */
if (len > NGX_SSL_MAX_SESSION_SIZE) {
if (len <= 0 || len > NGX_SSL_MAX_SESSION_SIZE) {
return;
}