mirror of
https://github.com/nginx/nginx.git
synced 2026-10-24 14:47:45 -05:00
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:
1 parent
e72a6a0bc3
commit
faf9438989
3 files changed
+3
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user