[PATCH] smtp-dummy: clear sockaddr_in structures before use.
Tomi Ollila
tomi.ollila at iki.fi
Thu Nov 10 15:32:20 PST 2011
Any junk bytes in sockaddr_in structures before passing those
to bind() or accept() functions may cause problems.
---
test/smtp-dummy.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c
index 9da8202..38d1d62 100644
--- a/test/smtp-dummy.c
+++ b/test/smtp-dummy.c
@@ -159,6 +159,7 @@ main (int argc, char *argv[])
return 1;
}
+ memset (&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
addr.sin_port = htons (25025);
addr.sin_addr = *(struct in_addr *) hostinfo->h_addr;
@@ -178,6 +179,7 @@ main (int argc, char *argv[])
return 1;
}
+ memset (&peer_addr, 0, sizeof peer_addr);
peer_addr_len = sizeof (peer_addr);
peer = accept (sock, (struct sockaddr *) &peer_addr, &peer_addr_len);
if (peer == -1) {
--
1.5.6.5
More information about the notmuch
mailing list