ignatenkobrain / rpms / nginx

Forked from rpms/nginx 2 years ago
Clone
67ea12
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
67ea12
index 0aaea47..fd6ecb0 100644
67ea12
--- a/src/http/v2/ngx_http_v2.c
67ea12
+++ b/src/http/v2/ngx_http_v2.c
67ea12
@@ -1549,6 +1549,14 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
67ea12
         header->name.len = h2c->state.field_end - h2c->state.field_start;
67ea12
         header->name.data = h2c->state.field_start;
67ea12
 
67ea12
+        if (header->name.len == 0) {
67ea12
+            ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
67ea12
+                          "client sent zero header name length");
67ea12
+
67ea12
+            return ngx_http_v2_connection_error(h2c,
67ea12
+                                                NGX_HTTP_V2_PROTOCOL_ERROR);
67ea12
+        }
67ea12
+
67ea12
         return ngx_http_v2_state_field_len(h2c, pos, end);
67ea12
     }
67ea12
 
67ea12
@@ -3259,10 +3267,6 @@ ngx_http_v2_validate_header(ngx_http_request_t *r, ngx_http_v2_header_t *header)
67ea12
     ngx_uint_t                 i;
67ea12
     ngx_http_core_srv_conf_t  *cscf;
67ea12
 
67ea12
-    if (header->name.len == 0) {
67ea12
-        return NGX_ERROR;
67ea12
-    }
67ea12
-
67ea12
     r->invalid_header = 0;
67ea12
 
67ea12
     cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);