1 Return-Path: <sascha-ml-email-notmuch-notmuch@silbe.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 934D1431FC0
\r
6 for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:45 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 F+bo1y+H2uwo for <notmuch@notmuchmail.org>;
\r
16 Sun, 24 Jun 2012 09:29:45 -0700 (PDT)
\r
17 Received: from smtp.chost.de (setoy.chost.de [217.160.209.225])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 62AFA431FAF
\r
21 for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:44 -0700 (PDT)
\r
22 Received: (qmail 14465 invoked by uid 5015); 24 Jun 2012 16:29:41 -0000
\r
23 Received: (nullmailer pid 3421 invoked by uid 123);
\r
24 Sun, 24 Jun 2012 16:29:39 -0000
\r
25 Received: from twin.sascha.silbe.org (twin.sascha.silbe.org [192.168.1.2])
\r
26 by flatty.sascha.silbe.org ([192.168.1.252])
\r
27 with SMTP via TCP; 24 Jun 2012 16:29:39 -0000
\r
28 Received: (nullmailer pid 25946 invoked by uid 8193);
\r
29 Sun, 24 Jun 2012 16:29:39 -0000
\r
30 From: Sascha Silbe <sascha-pgp@silbe.org>
\r
31 To: notmuch <notmuch@notmuchmail.org>
\r
32 Subject: [PATCH 1/3] lib: fix NULL checks for filenames iterators
\r
33 Date: Sun, 24 Jun 2012 18:29:24 +0200
\r
34 Message-Id: <1340555366-25891-2-git-send-email-sascha-pgp@silbe.org>
\r
35 X-Mailer: git-send-email 1.7.10
\r
36 In-Reply-To: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>
\r
37 References: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>
\r
38 Mail-Followup-To: notmuch <notmuch@notmuchmail.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 Reply-To: Sascha Silbe <sascha-ml-reply-to-2012-3@silbe.org>
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Sun, 24 Jun 2012 16:29:46 -0000
\r
54 The API documentation (notmuch.h) states that the parameter may be NULL,
\r
55 but the implementation only checked the current element, potentially
\r
56 dereferencing a NULL pointer in the process.
\r
58 Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
\r
60 lib/filenames.c | 4 ++--
\r
61 1 file changed, 2 insertions(+), 2 deletions(-)
\r
63 diff --git a/lib/filenames.c b/lib/filenames.c
\r
64 index f1ea243..4f7c0d8 100644
\r
65 --- a/lib/filenames.c
\r
66 +++ b/lib/filenames.c
\r
67 @@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)
\r
69 notmuch_filenames_get (notmuch_filenames_t *filenames)
\r
71 - if (filenames->iterator == NULL)
\r
72 + if ((filenames == NULL) || (filenames->iterator == NULL))
\r
75 return filenames->iterator->string;
\r
76 @@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)
\r
78 notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
\r
80 - if (filenames->iterator == NULL)
\r
81 + if ((filenames == NULL) || (filenames->iterator == NULL))
\r
84 filenames->iterator = filenames->iterator->next;
\r