[PATCH 2 of 3] QUIC: set c->socklen for streams

Roman Arutyunyan arut at nginx.com
Tue May 2 12:34:14 UTC 2023


# HG changeset patch
# User Roman Arutyunyan <arut at nginx.com>
# Date 1682610545 -14400
#      Thu Apr 27 19:49:05 2023 +0400
# Branch quic
# Node ID cdc41ec778ffae822fefce639e67f2f57e3667f0
# Parent  746a3a71e428796b0593d098fcd299b94cc00108
QUIC: set c->socklen for streams.

Previously, the value was not set and remained zero.  While in nginx code the
value of c->sockaddr is accessed without taking c->socklen into account,
invalid c->socklen could lead to unexpected results in third-party modules.

diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c
--- a/src/event/quic/ngx_event_quic_streams.c
+++ b/src/event/quic/ngx_event_quic_streams.c
@@ -711,6 +711,7 @@ ngx_quic_create_stream(ngx_connection_t 
     sc->pool = pool;
     sc->ssl = c->ssl;
     sc->sockaddr = c->sockaddr;
+    sc->socklen = c->socklen;
     sc->listening = c->listening;
     sc->addr_text = c->addr_text;
     sc->local_sockaddr = c->local_sockaddr;


More information about the nginx-devel mailing list