Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2022-10-17 15:24:53 +0300
committerSergey Kandaurov <pluknet@nginx.com>2022-10-17 15:24:53 +0300
commit35fce42269bf1c84eadef6660021cefa08a960d7 (patch)
tree744e00a403f7b2df47544e78bd1bc43318212d21
parent5b23fe690f0ddd0fe4af1ed01d7a4df95aa54d10 (diff)
SSL: improved validation of ssl_session_cache and ssl_ocsp_cache.
Now it properly detects invalid shared zone configuration with omitted size. Previously it used to read outside of the buffer boundary. Found with AddressSanitizer.
-rw-r--r--src/http/modules/ngx_http_ssl_module.c4
-rw-r--r--src/mail/ngx_mail_ssl_module.c2
-rw-r--r--src/stream/ngx_stream_ssl_module.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c
index d74d46094..6fe5463df 100644
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -1093,7 +1093,7 @@ ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
len++;
}
- if (len == 0) {
+ if (len == 0 || j == value[i].len) {
goto invalid;
}
@@ -1183,7 +1183,7 @@ ngx_http_ssl_ocsp_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
len++;
}
- if (len == 0) {
+ if (len == 0 || j == value[1].len) {
goto invalid;
}
diff --git a/src/mail/ngx_mail_ssl_module.c b/src/mail/ngx_mail_ssl_module.c
index 2a1043e66..b80a0ca80 100644
--- a/src/mail/ngx_mail_ssl_module.c
+++ b/src/mail/ngx_mail_ssl_module.c
@@ -682,7 +682,7 @@ ngx_mail_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
len++;
}
- if (len == 0) {
+ if (len == 0 || j == value[i].len) {
goto invalid;
}
diff --git a/src/stream/ngx_stream_ssl_module.c b/src/stream/ngx_stream_ssl_module.c
index c5308322a..105aa1178 100644
--- a/src/stream/ngx_stream_ssl_module.c
+++ b/src/stream/ngx_stream_ssl_module.c
@@ -1073,7 +1073,7 @@ ngx_stream_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
len++;
}
- if (len == 0) {
+ if (len == 0 || j == value[i].len) {
goto invalid;
}