ignatenkobrain / rpms / nginx

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