Fixed invalid access to complex value defined as an empty string.

Found by Valgrind.
This commit is contained in:
Sergey Kandaurov 2015-03-31 17:45:50 +03:00
parent 51df7912c4
commit 99bf1b56ec
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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);
}