summaryrefslogtreecommitdiff
path: root/drivers/unix
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-19 17:00:01 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-23 20:18:23 +0100
commit5dc7c920bf1c4bb160d39e13ad6136d80badd7ae (patch)
treebc71b2c2a03fdba566781a1b4c1a034818e662c4 /drivers/unix
parent93368571326e3472522669b76998f58aed78864f (diff)
Fix buffer size check in UDP socket.
We were reserving 12 bytes from the buffer for ip, port, and length, but since IPv6 introduction we should be reserving 24 (IPv6 are 16 bytes)
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
index a146a4a09f..7696a5fcb5 100644
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ b/drivers/unix/packet_peer_udp_posix.cpp
@@ -179,7 +179,7 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) {
struct sockaddr_storage from = {0};
socklen_t len = sizeof(struct sockaddr_storage);
int ret;
- while ( (ret = recvfrom(sockfd, recv_buffer, MIN((int)sizeof(recv_buffer),MAX(rb.space_left()-12, 0)), p_wait?0:MSG_DONTWAIT, (struct sockaddr*)&from, &len)) > 0) {
+ while ( (ret = recvfrom(sockfd, recv_buffer, MIN((int)sizeof(recv_buffer),MAX(rb.space_left()-24, 0)), p_wait?0:MSG_DONTWAIT, (struct sockaddr*)&from, &len)) > 0) {
uint32_t port = 0;