diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-18 18:27:53 +0300 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2019-07-18 18:27:53 +0300 |
| commit | ad42d70fed67c1e7098055fb25721ab904db2389 (patch) | |
| tree | 6748017ca7433b1712daa1b88307eca271c2018b /src | |
| parent | 20c8c4fe35d290abe298cea9a4f1756fcfec19f4 (diff) | |
| download | nginx-ad42d70fed67c1e7098055fb25721ab904db2389.tar.gz nginx-ad42d70fed67c1e7098055fb25721ab904db2389.tar.bz2 | |
SSI: avoid potential buffer overflow.
When "-" follows a parameter of maximum length, a single byte buffer
overflow happens, since the error branch does not check parameter length.
Fix is to avoid saving "-" to the parameter key, and instead use an error
message with "-" explicitly written. The message is mostly identical to
one used in similar cases in the preequal state.
Reported by Patrick Wollgast.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/modules/ngx_http_ssi_filter_module.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index d608df9df..6737965d1 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -1254,9 +1254,9 @@ ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx) case '-': state = ssi_error_end0_state; - ctx->param->key.data[ctx->param->key.len++] = ch; ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "invalid \"%V\" parameter in \"%V\" SSI command", + "unexpected \"-\" symbol after \"%V\" " + "parameter in \"%V\" SSI command", &ctx->param->key, &ctx->command); break; |
