summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-12 12:26:38 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-12 12:26:38 +0200
commitdcecde136a0c5e67c7caf3de9827e32737c75f90 (patch)
treea3b48404b5f33bbe1ca8a261467e5557d9d01a89
parent9c6dbdeecc620e1c3013914bf1bc8384be5b2a8b (diff)
stun: memset saddr before binding
We need to zero out data before we actually do the bind, otherwise uninitialized crap can be in saddr. Found by coverty scanner. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--stun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stun.c b/stun.c
index 4ea4eac..e39e76a 100644
--- a/stun.c
+++ b/stun.c
@@ -33,7 +33,7 @@
struct stun_header {
uint16_t type;
uint16_t len;
- uint32_t magic_cookie;
+ uint32_t magic_cookie;
uint32_t transid[3];
};
@@ -74,6 +74,7 @@ static int stun_test(const char *server_ip, int server_port,
set_reuseaddr(sock);
+ memset(&saddr, 0, sizeof(saddr));
saddr.sin_family = PF_INET;
saddr.sin_port = htons(tun_port);
saddr.sin_addr.s_addr = INADDR_ANY;