changeset 6062:173561dfd567

Fixed invalid access to complex value defined as an empty string. Found by Valgrind.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 31 Mar 2015 17:45:50 +0300
parents 953ef81705e1
children d698c300b9ff
files src/http/modules/ngx_http_headers_filter_module.c src/http/ngx_http_special_response.c
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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,
         }
     }
 
-    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,
 
         *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;
--- 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_reques
         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_reques
         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);
     }