1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 96DA1429E25
\r
6 for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 18:37:43 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id OsOiLR1JFA+8 for <notmuch@notmuchmail.org>;
\r
16 Fri, 11 Nov 2011 18:37:43 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 1ECE9431FB6
\r
20 for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 18:37:43 -0800 (PST)
\r
21 X-AuditID: 1209190f-b7f6e6d0000008df-a6-4ebddbf6704f
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id C6.16.02271.6FBDDBE4; Fri, 11 Nov 2011 21:37:42 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id pAC2bfmS017735;
\r
27 Fri, 11 Nov 2011 21:37:42 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pAC2bd5a004924
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Fri, 11 Nov 2011 21:37:41 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1RP3Vk-0005JW-LV; Fri, 11 Nov 2011 21:40:04 -0500
\r
37 Date: Fri, 11 Nov 2011 21:40:04 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Tomi Ollila <tomi.ollila@iki.fi>
\r
40 Subject: Re: [PATCH] smtp-dummy: clear sockaddr_in structures before use.
\r
41 Message-ID: <20111112024004.GX2658@mit.edu>
\r
42 References: <yf6k477a70b.fsf@taco2.nixu.fi>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 Content-Disposition: inline
\r
46 In-Reply-To: <yf6k477a70b.fsf@taco2.nixu.fi>
\r
47 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT1/12e6+fwYt+NYvrN2cyW7xZOY/V
\r
50 gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4Mo4u8+6YD1nxZPHq1kbGFezdzFyckgImEgs
\r
51 3LuSCcIWk7hwbz1bFyMXh5DAPkaJ9UveMUE4GxglNpw/yg7hnGSSeHJwElTZEkaJ3Vd6WUH6
\r
52 WQRUJd7t6wSbyyagIbFt/3JGEFtEQEXiQdt6sBpmAWmJb7+bwfYJC3hKnJ95CczmFdCWmPj+
\r
53 D1iNEJD9a/sbVoi4oMTJmU9YIHq1JG78ewlUzwE2Z/k/DpAwp4COxNYVTWBjRIFWTTm5jW0C
\r
54 o9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdELzezRC81pXQTIyisOSX5
\r
55 dzB+O6h0iFGAg1GJh3dB0l4/IdbEsuLK3EOMkhxMSqK8J24BhfiS8lMqMxKLM+KLSnNSiw8x
\r
56 SnAwK4nwds4FyvGmJFZWpRblw6SkOViUxHkbdzj4CQmkJ5akZqemFqQWwWRlODiUJHhbgfEr
\r
57 JFiUmp5akZaZU4KQZuLgBBnOAzR8F0gNb3FBYm5xZjpE/hSjopQ4bxpIQgAkkVGaB9cLSzuv
\r
58 GMWBXhHmrQGp4gGmLLjuV0CDmYAGsyiADS5JREhJNTCWH42P+hL+iiugY5Lyk6sKKS+rW9S6
\r
59 hGvFz4i8Z90fZhcqk7Djg4qGfoUK36GHxhaWqqH/S9cIeW5Xt81Jbpz2TUtARaYgeA/Dafuf
\r
60 b4LTNX0Nbzm3NRt5b5+3/c3F2q7bD71qJzcxLGDZ8Upo1/RraTWdcv6rBU7axgW5cE1epLPf
\r
61 IGbCYiWW4oxEQy3mouJEAEwhyD8WAwAA
\r
62 Cc: notmuch@notmuchmail.org
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Sat, 12 Nov 2011 02:37:43 -0000
\r
77 Looks good and is the right thing to do.
\r
79 The rest of smtp-dummy uses parens around sizeof operands, but whatever.
\r
81 It's probably not necessary to clear peer_addr, since it's an
\r
82 out-argument of accept and is never used (plus the example in bind(2)
\r
83 doesn't), but there's no harm.
\r
85 Quoth Tomi Ollila on Nov 11 at 1:32 am:
\r
86 > Any junk bytes in sockaddr_in structures before passing those
\r
87 > to bind() or accept() functions may cause problems.
\r
89 > test/smtp-dummy.c | 2 ++
\r
90 > 1 files changed, 2 insertions(+), 0 deletions(-)
\r
92 > diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c
\r
93 > index 9da8202..38d1d62 100644
\r
94 > --- a/test/smtp-dummy.c
\r
95 > +++ b/test/smtp-dummy.c
\r
96 > @@ -159,6 +159,7 @@ main (int argc, char *argv[])
\r
100 > + memset (&addr, 0, sizeof addr);
\r
101 > addr.sin_family = AF_INET;
\r
102 > addr.sin_port = htons (25025);
\r
103 > addr.sin_addr = *(struct in_addr *) hostinfo->h_addr;
\r
104 > @@ -178,6 +179,7 @@ main (int argc, char *argv[])
\r
108 > + memset (&peer_addr, 0, sizeof peer_addr);
\r
109 > peer_addr_len = sizeof (peer_addr);
\r
110 > peer = accept (sock, (struct sockaddr *) &peer_addr, &peer_addr_len);
\r
111 > if (peer == -1) {
\r