mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
HTTP/3: rearranged length check when parsing header.
The new code looks simpler and is similar to other checks.
This commit is contained in:
parent
ebbcc329cb
commit
be719bbec8
@ -212,6 +212,10 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (st->length == 0) {
|
||||||
|
return NGX_HTTP_V3_ERR_FRAME_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
st->state = sw_prefix;
|
st->state = sw_prefix;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -225,7 +229,7 @@ ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st,
|
|||||||
|
|
||||||
case sw_prefix:
|
case sw_prefix:
|
||||||
|
|
||||||
if (st->length-- == 0) {
|
if (--st->length == 0) {
|
||||||
return NGX_HTTP_V3_ERR_FRAME_ERROR;
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->length == 0) {
|
|
||||||
return NGX_HTTP_V3_ERR_FRAME_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
st->state = sw_verify;
|
st->state = sw_verify;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user