diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2015-03-31 17:45:50 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2015-03-31 17:45:50 +0300 |
commit | 99bf1b56ece3acd8cc5a0811de8098c828b151c8 (patch) | |
tree | a4aaf66ea019f284aef229969d6b780fd4619dad /src | |
parent | 51df7912c4a1320ead61cb57acdeaf16ffdcc289 (diff) | |
download | nginx-99bf1b56ece3acd8cc5a0811de8098c828b151c8.tar.gz nginx-99bf1b56ece3acd8cc5a0811de8098c828b151c8.zip |
Fixed invalid access to complex value defined as an empty string.
Found by Valgrind.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/modules/ngx_http_headers_filter_module.c | 6 | ||||
-rw-r--r-- | src/http/ngx_http_special_response.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c index a10056903..a356814e4 100644 --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -378,7 +378,7 @@ ngx_http_parse_expires(ngx_str_t *value, ngx_http_expires_t *expires, } } - if (value->data[0] == '@') { + if (value->len && value->data[0] == '@') { value->data++; value->len--; minus = 0; @@ -390,12 +390,12 @@ ngx_http_parse_expires(ngx_str_t *value, ngx_http_expires_t *expires, *expires = NGX_HTTP_EXPIRES_DAILY; - } else if (value->data[0] == '+') { + } else if (value->len && value->data[0] == '+') { value->data++; value->len--; minus = 0; - } else if (value->data[0] == '-') { + } else if (value->len && value->data[0] == '-') { value->data++; value->len--; minus = 1; diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c index 546400539..a97791e8b 100644 --- a/src/http/ngx_http_special_response.c +++ b/src/http/ngx_http_special_response.c @@ -553,7 +553,7 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) return NGX_ERROR; } - if (uri.data[0] == '/') { + if (uri.len && uri.data[0] == '/') { if (err_page->value.lengths) { ngx_http_split_args(r, &uri, &args); @@ -570,7 +570,7 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) return ngx_http_internal_redirect(r, &uri, &args); } - if (uri.data[0] == '@') { + if (uri.len && uri.data[0] == '@') { return ngx_http_named_location(r, &uri); } |