aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-09-16 20:21:03 +0100
committerRoman Arutyunyan <arut@nginx.com>2020-09-16 20:21:03 +0100
commitbe719bbec8a9130223e25c4c22b52a73c44eb1ec (patch)
tree8073b17509623fcfb89cc74ebe7e31d91b925843 /src
parentebbcc329cb5f9878d2eb27f53e74e951bdaa449d (diff)
downloadnginx-be719bbec8a9130223e25c4c22b52a73c44eb1ec.tar.gz
nginx-be719bbec8a9130223e25c4c22b52a73c44eb1ec.zip
HTTP/3: rearranged length check when parsing header.
The new code looks simpler and is similar to other checks.
Diffstat (limited to 'src')
-rw-r--r--src/http/v3/ngx_http_v3_parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/http/v3/ngx_http_v3_parse.c b/src/http/v3/ngx_http_v3_parse.c
index 96f87b0b6..6ce5f10a7 100644
--- a/src/http/v3/ngx_http_v3_parse.c
+++ b/src/http/v3/ngx_http_v3_parse.c
@@ -212,6 +212,10 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
break;
}
+ if (st->length == 0) {
+ return NGX_HTTP_V3_ERR_FRAME_ERROR;
+ }
+
st->state = sw_prefix;
break;
@@ -225,7 +229,7 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
case sw_prefix:
- if (st->length-- == 0) {
+ if (--st->length == 0) {
return NGX_HTTP_V3_ERR_FRAME_ERROR;
}
@@ -234,10 +238,6 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
return rc;
}
- if (st->length == 0) {
- return NGX_HTTP_V3_ERR_FRAME_ERROR;
- }
-
st->state = sw_verify;
break;