From dcecde136a0c5e67c7caf3de9827e32737c75f90 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 12 Jun 2013 12:26:38 +0200 Subject: [PATCH] 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 --- stun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stun.c b/stun.c index 4ea4eac2..e39e76a4 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; -- 2.11.4.GIT