Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] QUIC: better sockaddr initialization

Maxim Dounin
May 21, 2023 08:58AM
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
Subject Author Views Posted

[PATCH] QUIC: better sockaddr initialization

Maxim Dounin 261 May 20, 2023 09:44PM

Re: [PATCH] QUIC: better sockaddr initialization

Roman Arutyunyan 74 May 21, 2023 05:08AM

Re: [PATCH] QUIC: better sockaddr initialization

Maxim Dounin 73 May 21, 2023 08:58AM

Re: [PATCH] QUIC: better sockaddr initialization

Alejandro Colomar 91 May 21, 2023 05:32AM

Re: [PATCH] QUIC: better sockaddr initialization

Maxim Dounin 81 May 21, 2023 09:12AM

Re: [PATCH] QUIC: better sockaddr initialization

Alejandro Colomar 71 May 21, 2023 10:36AM

Re: [PATCH] QUIC: better sockaddr initialization

Maxim Dounin 81 May 21, 2023 05:24PM

Re: [PATCH] QUIC: better sockaddr initialization

Alejandro Colomar 107 May 21, 2023 07:08PM

Re: [PATCH] QUIC: better sockaddr initialization

Maxim Dounin 78 May 21, 2023 10:36PM

memcpy(3), strict aliasing, pointer provenance rules (was: [PATCH] QUIC: better sockaddr initialization)

Alejandro Colomar 109 May 22, 2023 10:26AM

Re: memcpy(3), strict aliasing, pointer provenance rules (was: [PATCH] QUIC: better sockaddr initialization)

Maxim Dounin 121 May 22, 2023 04:06PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 88
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready