QUIC: better sockaddr initialization.

The qsock->sockaddr field is a ngx_sockaddr_t union, and therefore can hold
any sockaddr (and union members, such qsock->sockaddr.sockaddr, can be used
to access appropriate variant of the sockaddr).  It is better to set it via
qsock->sockaddr itself though, and not qsock->sockaddr.sockaddr, so static
analyzers won't complain about out-of-bounds access.

Prodded by Coverity (CID 1530403).
This commit is contained in:
Maxim Dounin 2023-05-21 04:38:45 +03:00
parent 4b02661748
commit 0400e3d5ce

View File

@ -183,7 +183,7 @@ ngx_quic_recvmsg(ngx_event_t *ev)
qsock = ngx_quic_get_socket(c);
ngx_memcpy(&qsock->sockaddr.sockaddr, sockaddr, socklen);
ngx_memcpy(&qsock->sockaddr, sockaddr, socklen);
qsock->socklen = socklen;
c->udp->buffer = &buf;