vquic: ignore 0-length UDP packets

When someone gives us 0-length UDP packets, ignore
them as they cannot be valid QUIC packets. This also
prevents us from messing up any GSO calculations.

Reported-by: Stanislav Fort
Closes #19978
This commit is contained in:
Stefan Eissing 2025-12-15 11:15:38 +01:00 committed by Daniel Stenberg
parent 9b3557b706
commit 6a3d0b6d63
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -441,12 +441,14 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf,
++calls;
for(i = 0; i < mcount; ++i) {
/* A zero-length UDP packet is no QUIC packet. Ignore. */
if(!mmsg[i].msg_len)
continue;
total_nread += mmsg[i].msg_len;
gso_size = vquic_msghdr_get_udp_gro(&mmsg[i].msg_hdr);
if(gso_size == 0) {
if(gso_size == 0)
gso_size = mmsg[i].msg_len;
}
result = recv_cb(bufs[i], mmsg[i].msg_len, gso_size,
mmsg[i].msg_hdr.msg_name,
@ -523,10 +525,13 @@ static CURLcode recvmsg_packets(struct Curl_cfilter *cf,
total_nread += nread;
++calls;
/* A 0-length UDP packet is no QUIC packet */
if(!nread)
continue;
gso_size = vquic_msghdr_get_udp_gro(&msg);
if(gso_size == 0) {
if(gso_size == 0)
gso_size = nread;
}
result = recv_cb(buf, nread, gso_size,
msg.msg_name, msg.msg_namelen, 0, userp);
@ -587,6 +592,11 @@ static CURLcode recvfrom_packets(struct Curl_cfilter *cf,
++pkts;
++calls;
/* A 0-length UDP packet is no QUIC packet */
if(!nread)
continue;
total_nread += nread;
result = recv_cb(buf, nread, nread, &remote_addr, remote_addrlen,
0, userp);