]> git.kaiwu.me - nginx.git/commitdiff
QUIC: client transport parameter data length checking.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 28 May 2024 13:17:19 +0000 (17:17 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Tue, 28 May 2024 13:17:19 +0000 (17:17 +0400)
src/event/quic/ngx_event_quic_transport.c

index 19670a6b1dc9ef6bb43e4096927c3668372c9227..fba098caa95ee05bf6211053ac4f41f33b51f033 100644 (file)
@@ -1750,6 +1750,14 @@ ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
             return NGX_ERROR;
         }
 
+        if ((size_t) (end - p) < len) {
+            ngx_log_error(NGX_LOG_INFO, log, 0,
+                          "quic failed to parse"
+                          " transport param id:0x%xL, data length %uL too long",
+                          id, len);
+            return NGX_ERROR;
+        }
+
         rc = ngx_quic_parse_transport_param(p, p + len, id, tp);
 
         if (rc == NGX_ERROR) {