1 Return-Path: <hohndel@gr8dns.org>
\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 20B1241733A
\r
6 for <notmuch@notmuchmail.org>; Tue, 27 Apr 2010 16:29:36 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\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 NBFCTHlqS053 for <notmuch@notmuchmail.org>;
\r
16 Tue, 27 Apr 2010 16:29:34 -0700 (PDT)
\r
17 Received: from mail.hohndel.org (mail.hohndel.org [65.23.157.147])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 3A4AB4196F5
\r
19 for <notmuch@notmuchmail.org>; Tue, 27 Apr 2010 16:29:32 -0700 (PDT)
\r
20 Received: by mail.hohndel.org (Postfix, from userid 112)
\r
21 id 6CFDF758001; Tue, 27 Apr 2010 19:29:31 -0400 (EDT)
\r
22 Received: from x200.gr8dns.org (unknown [65.23.157.147])
\r
23 by mail.hohndel.org (Postfix) with ESMTP id 65004340FA;
\r
24 Tue, 27 Apr 2010 19:29:25 -0400 (EDT)
\r
25 Received: by x200.gr8dns.org (Postfix, from userid 500)
\r
26 id 7D9F7CCD12; Tue, 27 Apr 2010 16:29:25 -0700 (PDT)
\r
27 From: Dirk Hohndel <hohndel@infradead.org>
\r
28 To: <notmuch@notmuchmail.org>
\r
29 Subject: [PATCH 1/2] Fix SEGV in _thread_cleanup_author if author ends with ',
\r
31 Date: Tue, 27 Apr 2010 16:29:22 -0700
\r
32 Message-Id: <1272410963-2106-2-git-send-email-hohndel@infradead.org>
\r
33 X-Mailer: git-send-email 1.6.6.1
\r
34 In-Reply-To: <1272410963-2106-1-git-send-email-hohndel@infradead.org>
\r
35 References: <1272410963-2106-1-git-send-email-hohndel@infradead.org>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Tue, 27 Apr 2010 23:29:36 -0000
\r
50 Admittedly, an author name ending in ',' guarantees this is spam, and
\r
51 indeed this was triggered by a spam email, but that doesn't mean we
\r
52 shouldn't handle this case correctly.
\r
53 We now check that there is actually a component of the name (presumably
\r
54 the first name) after the comma in the author name.
\r
56 Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
\r
58 lib/thread.cc | 11 +++++++++--
\r
59 1 files changed, 9 insertions(+), 2 deletions(-)
\r
61 diff --git a/lib/thread.cc b/lib/thread.cc
\r
62 index dc74ee3..13872d4 100644
\r
65 @@ -156,11 +156,19 @@ _thread_cleanup_author (notmuch_thread_t *thread,
\r
69 + if (author == NULL)
\r
71 clean_author = talloc_strdup(thread, author);
\r
72 if (clean_author == NULL)
\r
74 + /* check if there's a comma in the name and that there's a
\r
75 + * component of the name behind it (so the name doesn't end with
\r
76 + * the comma - in which case the string that strchr finds is just
\r
77 + * one character long ",\0").
\r
78 + * Otherwise just return the copy of the original author name that
\r
80 comma = strchr(author,',');
\r
82 + if (comma && strlen(comma) > 1) {
\r
83 /* let's assemble what we think is the correct name */
\r
84 lname = comma - author;
\r
85 fname = strlen(author) - lname - 2;
\r
86 @@ -180,7 +188,6 @@ _thread_cleanup_author (notmuch_thread_t *thread,
\r
87 /* we didn't identify this as part of the email address
\r
88 * so let's punt and return the original author */
\r
89 strcpy (clean_author, author);
\r
92 return clean_author;
\r