Merge pull request #634 from julek-wolfssl/fenrir-13971-dtls-demux-empty-datagram

F-13971: Ignore zero-length datagrams in DTLS demux server
pull/645/head
philljj 2026-10-13 00:41:35 -05:00 committed by GitHub
commit e21e4c708c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -316,8 +316,15 @@ int main(void)
struct ConnList *conn = NULL;
sz = recvfrom(listenfd.fd, readBuf, sizeof(readBuf), 0, &peerAddr, &peerAddrLen);
if (sz <= 0)
if (sz < 0) {
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
continue;
perror("recvfrom");
goto cleanup;
}
/* Empty datagrams are valid UDP. Drop them. */
if (sz == 0)
continue;
/* find ssl object */
conn = findConn(connList, readBuf, sz, &peerAddr, peerAddrLen);