1 Return-Path: <amthrax@drake.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 617FE431FBC
\r
6 for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 21:50:17 -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 64oBZNsTE7Wg for <notmuch@notmuchmail.org>;
\r
16 Sat, 28 Jan 2012 21:50:16 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 520C6431FD2
\r
20 for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 21:50:16 -0800 (PST)
\r
21 X-AuditID: 12074423-b7f9c6d0000008c3-84-4f24de165507
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id BC.EA.02243.61ED42F4; Sun, 29 Jan 2012 00:50:15 -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 q0T5oEnN009502;
\r
27 Sun, 29 Jan 2012 00:50:14 -0500
\r
28 Received: from drake.mit.edu
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0T5oCF4028023
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sun, 29 Jan 2012 00:50:13 -0500 (EST)
\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)
\r
36 (envelope-from <amthrax@drake.mit.edu>)
\r
37 id 1RrNeV-0007ab-Vk; Sun, 29 Jan 2012 00:50:12 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 1/3] lib: Don't delete uninitialized pointers
\r
41 Date: Sun, 29 Jan 2012 00:50:08 -0500
\r
42 Message-Id: <1327816210-29124-1-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.7.3
\r
44 X-Brightmail-Tracker:
\r
45 H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixG6nrit+T8Xf4PFrRovrN2cyOzB6PFt1
\r
46 izmAMYrLJiU1J7MstUjfLoEr49S8+ywFk9krXnXfYmlgfMXaxcjJISFgInFm3U8mCFtM4sK9
\r
47 9WxdjFwcQgL7GCWu/F3KCOFsYJTYe/szVOY+k8Tv2c9ZIJz5jBJN65Yxg/SzCWhIbNu/nBHE
\r
48 FhGQlth5dzbQDg4OZgE1iT9dKl2M7BzCArYS781AClgEVCWunLjKBmLzCjhIHOu4wAhxhILE
\r
49 udXn2Ccw8i5gZFjFKJuSW6Wbm5iZU5yarFucnJiXl1qka6aXm1mil5pSuokRHAIuyjsY/xxU
\r
50 OsQowMGoxMOrsELFX4g1say4MvcQoyQHk5Io74I7QCG+pPyUyozE4oz4otKc1OJDjBIczEoi
\r
51 vI4zgXK8KYmVValF+TApaQ4WJXFeDa13fkIC6YklqdmpqQWpRTBZGQ4OJQneuLtAjYJFqemp
\r
52 FWmZOSUIaSYOTpDhPEDDPUBqeIsLEnOLM9Mh8qcYFaXEef1BEgIgiYzSPLheWIy+YhQHekWY
\r
53 1wekigcY33Ddr4AGMwENjriqCDK4JBEhJdXAuNVcd1Wm9XOm31Mbpz842Zqw5LN6z3KOa+ly
\r
54 C/n++CxIT02fo5VhJN9Wyz/x0eO0OfsSZuvdvffkpnev5GZJ9cAF114yvJfwzH6QW5iw6tzH
\r
55 tdcceuZesWpZId4b3y+yrtZMeHvzJeM/Wxad+z2F+fjv9ZtdRF2XT9s86+fzrxZCx/8wVJ0S
\r
56 OaHEUpyRaKjFXFScCABi/HHjrAIAAA==
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sun, 29 Jan 2012 05:50:17 -0000
\r
71 In the error-handling paths of notmuch_database_open, we call
\r
72 notmuch_database_close, which "delete"s several objects referenced by
\r
73 the notmuch_database_t object. However, some of these pointers may be
\r
74 uninitialized, resulting in undefined behavior. Hence, allocate the
\r
75 notmuch_database_t with talloc_zero to make sure these pointers are
\r
76 NULL so that "delete"ing them is harmless.
\r
78 lib/database.cc | 2 +-
\r
79 1 files changed, 1 insertions(+), 1 deletions(-)
\r
81 diff --git a/lib/database.cc b/lib/database.cc
\r
82 index 8103bd9..a6d15a1 100644
\r
83 --- a/lib/database.cc
\r
84 +++ b/lib/database.cc
\r
85 @@ -617,7 +617,7 @@ notmuch_database_open (const char *path,
\r
89 - notmuch = talloc (NULL, notmuch_database_t);
\r
90 + notmuch = talloc_zero (NULL, notmuch_database_t);
\r
91 notmuch->exception_reported = FALSE;
\r
92 notmuch->path = talloc_strdup (notmuch, path);
\r