From 69b7b28e8406723a03df6c57500a9e699d2823c3 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 17 May 2024 16:50:49 +0100 Subject: [PATCH] - HAL socket: added missing initialization of address structure --- hal/socket/linux/socket_linux.c | 1 + hal/socket/win32/socket_win32.c | 1 + 2 files changed, 2 insertions(+) diff --git a/hal/socket/linux/socket_linux.c b/hal/socket/linux/socket_linux.c index c188c24f..fffc72ae 100644 --- a/hal/socket/linux/socket_linux.c +++ b/hal/socket/linux/socket_linux.c @@ -816,6 +816,7 @@ int UdpSocket_receiveFrom(UdpSocket self, char* address, int maxAddrSize, uint8_t* msg, int msgSize) { struct sockaddr_storage remoteAddress; + memset(&remoteAddress, 0, sizeof(struct sockaddr_storage)); socklen_t structSize = sizeof(struct sockaddr_storage); int result = recvfrom(self->fd, msg, msgSize, MSG_DONTWAIT, (struct sockaddr*)&remoteAddress, &structSize); diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index 65be99d7..5b8c448f 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -749,6 +749,7 @@ int UdpSocket_receiveFrom(UdpSocket self, char* address, int maxAddrSize, uint8_t* msg, int msgSize) { struct sockaddr_storage remoteAddress; + memset(&remoteAddress, 0, sizeof(struct sockaddr_storage)); socklen_t structSize = sizeof(struct sockaddr_storage); int result = recvfrom(self->fd, (char*) msg, msgSize, 0, (struct sockaddr*)&remoteAddress, &structSize);