Skip to content

Commit

Permalink
SSL: improved validation of ssl_session_cache and ssl_ocsp_cache.
Browse files Browse the repository at this point in the history
Now it properly detects invalid shared zone configuration with omitted size.
Previously it used to read outside of the buffer boundary.

Found with AddressSanitizer.
  • Loading branch information
pluknet committed Oct 17, 2022
1 parent 5b23fe6 commit 35fce42
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/http/modules/ngx_http_ssl_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mail/ngx_mail_ssl_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/stream/ngx_stream_ssl_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 35fce42

Please sign in to comment.