BUILD: quic: fix warning during compilation using gcc-6.5

Building with gcc-6.5:

src/quic_conn.c: In function 'send_retry':
src/quic_conn.c:6554:2: error: dereferencing type-punned pointer will break
strict-aliasing rules [-Werror=strict-aliasing]
   *((uint32_t *)((unsigned char *)&buf[i])) = htonl(qv->num);

This patch use write_n32 to set the value.

This could be backported until v2.6
This commit is contained in:
Emeric Brun 2023-07-17 18:33:44 +02:00 committed by Amaury Denoyelle
parent e5a17b0bc0
commit c0456f45c8

View File

@ -6552,7 +6552,7 @@ static int send_retry(int fd, struct sockaddr_storage *addr,
(quic_pkt_type(QUIC_PACKET_TYPE_RETRY, qv->num) << QUIC_PACKET_TYPE_SHIFT) |
statistical_prng_range(16);
/* version */
*(uint32_t *)&buf[i] = htonl(qv->num);
write_n32(&buf[i], qv->num);
i += sizeof(uint32_t);
/* Use the SCID from <pkt> for Retry DCID. */