Mercurial > hg > nginx-quic
changeset 8090:351d62300832 quic
HTTP/3: rearranged length check when parsing header.
The new code looks simpler and is similar to other checks.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 16 Sep 2020 20:21:03 +0100 |
parents | 5a794d2452ef |
children | dbcb9d0a3df1 |
files | src/http/v3/ngx_http_v3_parse.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 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 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 return rc; } - if (st->length == 0) { - return NGX_HTTP_V3_ERR_FRAME_ERROR; - } - st->state = sw_verify; break;