aboutsummaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorproller <proler@github.com>2013-11-05 16:57:43 +0400
committerproller <proler@github.com>2013-11-06 00:50:32 +0400
commit8903c68460d79aeac6b1c5074003743f98371339 (patch)
treef96de4f3e1398b68e3316a9641f31ef0aad996af /src/socket.cpp
parent6f44492238c89079402a984466d037f4558924e6 (diff)
downloadminetest-8903c68460d79aeac6b1c5074003743f98371339.tar.gz
minetest-8903c68460d79aeac6b1c5074003743f98371339.tar.bz2
minetest-8903c68460d79aeac6b1c5074003743f98371339.zip
Correct useragent in http queries
Net struct init
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 1c07c44d5..c3873dab6 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -345,6 +345,8 @@ void UDPSocket::Bind(u16 port)
if(m_addr_family == AF_INET6)
{
struct sockaddr_in6 address;
+ memset(&address, 0, sizeof(address));
+
address.sin6_family = AF_INET6;
address.sin6_addr = in6addr_any;
address.sin6_port = htons(port);
@@ -360,6 +362,8 @@ void UDPSocket::Bind(u16 port)
else
{
struct sockaddr_in address;
+ memset(&address, 0, sizeof(address));
+
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port);
@@ -454,6 +458,7 @@ int UDPSocket::Receive(Address & sender, void * data, int size)
if(m_addr_family == AF_INET6)
{
struct sockaddr_in6 address;
+ memset(&address, 0, sizeof(address));
socklen_t address_len = sizeof(address);
received = recvfrom(m_handle, (char *) data,
@@ -470,6 +475,8 @@ int UDPSocket::Receive(Address & sender, void * data, int size)
else
{
struct sockaddr_in address;
+ memset(&address, 0, sizeof(address));
+
socklen_t address_len = sizeof(address);
received = recvfrom(m_handle, (char *) data,
@@ -568,5 +575,3 @@ bool UDPSocket::WaitData(int timeout_ms)
// There is data
return true;
}
-
-