Welcome! Log In Create A New Profile

Advanced

[nginx] QUIC: better sockaddr initialization.

Sergey Kandaurov
May 22, 2023 08:22AM
details: https://hg.nginx.org/nginx/rev/68fa4b86ed46
branches:
changeset: 9111:68fa4b86ed46
user: Maxim Dounin <mdounin@mdounin.ru>
date: Sun May 21 04:38:45 2023 +0300
description:
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).

diffstat:

src/event/quic/ngx_event_quic_udp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 235d482ef6bc -r 68fa4b86ed46 src/event/quic/ngx_event_quic_udp.c
--- a/src/event/quic/ngx_event_quic_udp.c Fri May 19 21:46:36 2023 +0400
+++ b/src/event/quic/ngx_event_quic_udp.c Sun May 21 04:38:45 2023 +0300
@@ -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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] QUIC: better sockaddr initialization.

Sergey Kandaurov 281 May 22, 2023 08:22AM



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

Online Users

Guests: 190
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready