Hello!
On Sun, May 21, 2023 at 01:06:59PM +0400, Roman Arutyunyan wrote:
> On Sun, May 21, 2023 at 04:42:30AM +0300, Maxim Dounin wrote:
> > # HG changeset patch
> > # User Maxim Dounin <mdounin@mdounin.ru>
> > # Date 1684633125 -10800
> > # Sun May 21 04:38:45 2023 +0300
> > # Node ID 68fa4b86ed46138dd1a8fcf2cfd80206de068bec
> > # Parent 235d482ef6bc8c40a956b2413865d42c94e0fc05
> > 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).
> >
> > diff --git a/src/event/quic/ngx_event_quic_udp.c b/src/event/quic/ngx_event_quic_udp.c
> > --- a/src/event/quic/ngx_event_quic_udp.c
> > +++ b/src/event/quic/ngx_event_quic_udp.c
> > @@ -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;
>
> Looks good
Thanks, pushed to http://mdounin.ru/hg/nginx.
--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel