unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] smtp-dummy: clear sockaddr_in structures before use.
@ 2011-11-10 23:32 Tomi Ollila
  2011-11-12  2:40 ` Austin Clements
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2011-11-10 23:32 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-12 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 23:32 [PATCH] smtp-dummy: clear sockaddr_in structures before use Tomi Ollila
2011-11-12  2:40 ` Austin Clements
2011-11-12  9:57   ` [PATCH] smtp-dummy: clear sockaddr_in structure before use in bind() Tomi Ollila
2011-11-12 12:55     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).