changeset 8242:83a78cca8bce quic

Fixed build.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 19 Mar 2020 17:22:43 +0300
parents db745339e54b
children 59e639379c7c
files src/event/ngx_event_quic_transport.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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: