]> git.kaiwu.me - nginx.git/commitdiff
Assorted fixes.
authorSergey Kandaurov <pluknet@nginx.com>
Wed, 20 May 2020 12:36:24 +0000 (15:36 +0300)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 20 May 2020 12:36:24 +0000 (15:36 +0300)
Found by Clang Static Analyzer.

src/event/ngx_event_quic.c
src/event/ngx_event_quic_protection.c
src/http/v3/ngx_http_v3_request.c

index 714660dbbbc95819d9c40919b079e978fd036f59..54322b93845422451c45593cb1baffef364fbbd2 100644 (file)
@@ -1081,6 +1081,7 @@ ngx_quic_input_handler(ngx_event_t *rev)
     ngx_quic_connection_t  *qc;
     static u_char           buf[NGX_QUIC_DEFAULT_MAX_PACKET_SIZE];
 
+    ngx_memzero(&b, sizeof(ngx_buf_t));
     b.start = buf;
     b.end = buf + sizeof(buf);
     b.pos = b.last = b.start;
@@ -1438,8 +1439,6 @@ ngx_quic_retry_input(ngx_connection_t *c, ngx_quic_header_t *pkt)
 
     c->log->action = "retrying quic connection";
 
-    qc = c->quic;
-
     if (ngx_buf_size(pkt->raw) < NGX_QUIC_MIN_INITIAL_SIZE) {
         ngx_log_error(NGX_LOG_INFO, c->log, 0,
                       "quic UDP datagram is too small for initial packet");
@@ -3243,7 +3242,6 @@ ngx_quic_retransmit(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
     qc = c->quic;
 
     now = ngx_current_msec;
-    wait = 0;
 
     if (ngx_queue_empty(&ctx->sent)) {
         *waitp = 0;
@@ -3949,6 +3947,7 @@ ngx_quic_free_frame(ngx_connection_t *c, ngx_quic_frame_t *frame)
 
     if (frame->data) {
         ngx_free(frame->data);
+        frame->data = NULL;
     }
 
     ngx_queue_insert_head(&qc->free_frames, &frame->queue);
index e44a13dee4c18a56370d0e00896619a199c1de1a..c4620c7411b3b341b88ea2af1c2e1e687d2e7a70 100644 (file)
@@ -914,6 +914,7 @@ ngx_quic_create_retry_packet(ngx_quic_header_t *pkt, ngx_str_t *res)
     ad.len = ngx_quic_create_retry_itag(pkt, ad.data, &start);
 
     itag.data = ad.data + ad.len;
+    itag.len = EVP_GCM_TLS_TAG_LEN;
 
 #ifdef NGX_QUIC_DEBUG_CRYPTO
     ngx_quic_hexdump(pkt->log, "quic retry itag", ad.data, ad.len);
@@ -960,7 +961,7 @@ ngx_quic_parse_pn(u_char **pos, ngx_int_t len, u_char *mask,
     *pos = p;
 
     expected_pn = *largest_pn + 1;
-    pn_win = 1 << pn_nbits;
+    pn_win = 1ULL << pn_nbits;
     pn_hwin = pn_win / 2;
     pn_mask = pn_win - 1;
 
index e0ee0c882a253c90119a2abae464691bb23d32ce..c4b313d31258fb0a3969c9de22922b028672dc2c 100644 (file)
@@ -618,7 +618,7 @@ ngx_http_v3_create_header(ngx_http_request_t *r)
 
         b = ngx_create_temp_buf(c->pool, len);
         if (b == NULL) {
-            NULL;
+            return NULL;
         }
 
         *b->last++ = NGX_HTTP_V3_FRAME_DATA;