This commit is contained in:
J. Nick Koston
2026-03-16 11:01:21 -10:00
parent 86e4341a52
commit 75efdd8662
@@ -1259,11 +1259,10 @@ ssize_t LWIPRawUDPRecvImpl::recvfrom(void *buf, size_t len, struct sockaddr *src
// Fill in source address if requested.
// If ip2sockaddr_ fails (e.g., addrlen too small), fail the entire recvfrom
// rather than silently returning data without a source address.
if (src_addr != nullptr && addrlen != nullptr) {
if (this->ip2sockaddr_(&pkt.src_addr, pkt.src_port, src_addr, addrlen) != 0) {
// Put the packet back — don't consume it on address conversion failure
return -1;
}
if (src_addr != nullptr && addrlen != nullptr &&
this->ip2sockaddr_(&pkt.src_addr, pkt.src_port, src_addr, addrlen) != 0) {
// Don't consume the packet on address conversion failure
return -1;
}
// Free the pbuf and advance the read pointer