# HG changeset patch # User Sergey Kandaurov # Date 1584627763 -10800 # Node ID 83a78cca8bcea7a4f46ee9a8c053e0232ddb9845 # Parent db745339e54b77103173fd8f3af93bbb1829b982 Fixed build. diff --git a/src/event/ngx_event_quic_transport.c b/src/event/ngx_event_quic_transport.c --- a/src/event/ngx_event_quic_transport.c +++ b/src/event/ngx_event_quic_transport.c @@ -397,7 +397,7 @@ ngx_int_t ngx_quic_parse_initial_header(ngx_quic_header_t *pkt) { u_char *p, *end; - uint64_t plen; + uint64_t varint; p = pkt->raw->pos; @@ -405,12 +405,14 @@ ngx_quic_parse_initial_header(ngx_quic_h pkt->log->action = "parsing quic initial header"; - p = ngx_quic_parse_int(p, end, &pkt->token.len); + p = ngx_quic_parse_int(p, end, &varint); if (p == NULL) { ngx_log_error(NGX_LOG_ERR, pkt->log, 0, "failed to parse token length"); return NGX_ERROR; } + pkt->token.len = varint; + p = ngx_quic_read_bytes(p, end, pkt->token.len, &pkt->token.data); if (p == NULL) { ngx_log_error(NGX_LOG_ERR, pkt->log, 0, @@ -418,22 +420,22 @@ ngx_quic_parse_initial_header(ngx_quic_h return NGX_ERROR; } - p = ngx_quic_parse_int(p, end, &plen); + p = ngx_quic_parse_int(p, end, &varint); if (p == NULL) { ngx_log_error(NGX_LOG_ERR, pkt->log, 0, "bad packet length"); return NGX_ERROR; } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, - "quic packet length: %d", plen); + "quic packet length: %d", varint); - if (plen > (uint64_t) ((pkt->data + pkt->len) - p)) { + if (varint > (uint64_t) ((pkt->data + pkt->len) - p)) { ngx_log_error(NGX_LOG_ERR, pkt->log, 0, "truncated initial packet"); return NGX_ERROR; } pkt->raw->pos = p; - pkt->len = plen; + pkt->len = varint; ngx_quic_hexdump0(pkt->log, "DCID", pkt->dcid.data, pkt->dcid.len); ngx_quic_hexdump0(pkt->log, "SCID", pkt->scid.data, pkt->scid.len); @@ -483,19 +485,22 @@ ssize_t ngx_quic_parse_frame(ngx_quic_header_t *pkt, u_char *start, u_char *end, ngx_quic_frame_t *f) { - u_char *p; + u_char *p; + uint64_t varint; p = start; /* TODO: add a check if frame is allowed in this type of packet */ - p = ngx_quic_parse_int(p, end, &f->type); + p = ngx_quic_parse_int(p, end, &varint); if (p == NULL) { ngx_log_error(NGX_LOG_ERR, pkt->log, 0, "failed to obtain quic frame type"); return NGX_ERROR; } + f->type = varint; + switch (f->type) { case NGX_QUIC_FT_CRYPTO: