[PATCH 1/3] lib: fix NULL checks for filenames iterators
authorSascha Silbe <sascha-pgp@silbe.org>
Sun, 24 Jun 2012 16:29:24 +0000 (18:29 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:47 +0000 (09:47 -0800)
d8/7e8cc6f0f6ffdbae0ee1a560a8a8de38e9d229 [new file with mode: 0644]

diff --git a/d8/7e8cc6f0f6ffdbae0ee1a560a8a8de38e9d229 b/d8/7e8cc6f0f6ffdbae0ee1a560a8a8de38e9d229
new file mode 100644 (file)
index 0000000..808a469
--- /dev/null
@@ -0,0 +1,87 @@
+Return-Path: <sascha-ml-email-notmuch-notmuch@silbe.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 934D1431FC0\r
+       for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:45 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id F+bo1y+H2uwo for <notmuch@notmuchmail.org>;\r
+       Sun, 24 Jun 2012 09:29:45 -0700 (PDT)\r
+Received: from smtp.chost.de (setoy.chost.de [217.160.209.225])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 62AFA431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 24 Jun 2012 09:29:44 -0700 (PDT)\r
+Received: (qmail 14465 invoked by uid 5015); 24 Jun 2012 16:29:41 -0000\r
+Received: (nullmailer pid 3421 invoked by uid 123);\r
+       Sun, 24 Jun 2012 16:29:39 -0000\r
+Received: from twin.sascha.silbe.org (twin.sascha.silbe.org [192.168.1.2])\r
+       by flatty.sascha.silbe.org ([192.168.1.252])\r
+       with SMTP via TCP; 24 Jun 2012 16:29:39 -0000\r
+Received: (nullmailer pid 25946 invoked by uid 8193);\r
+       Sun, 24 Jun 2012 16:29:39 -0000\r
+From: Sascha Silbe <sascha-pgp@silbe.org>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/3] lib: fix NULL checks for filenames iterators\r
+Date: Sun, 24 Jun 2012 18:29:24 +0200\r
+Message-Id: <1340555366-25891-2-git-send-email-sascha-pgp@silbe.org>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>\r
+References: <1340555366-25891-1-git-send-email-sascha-pgp@silbe.org>\r
+Mail-Followup-To: notmuch <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+Reply-To: Sascha Silbe <sascha-ml-reply-to-2012-3@silbe.org>\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 24 Jun 2012 16:29:46 -0000\r
+\r
+The API documentation (notmuch.h) states that the parameter may be NULL,\r
+but the implementation only checked the current element, potentially\r
+dereferencing a NULL pointer in the process.\r
+\r
+Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>\r
+---\r
+ lib/filenames.c |    4 ++--\r
+ 1 file changed, 2 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/lib/filenames.c b/lib/filenames.c\r
+index f1ea243..4f7c0d8 100644\r
+--- a/lib/filenames.c\r
++++ b/lib/filenames.c\r
+@@ -54,7 +54,7 @@ notmuch_filenames_valid (notmuch_filenames_t *filenames)\r
+ const char *\r
+ notmuch_filenames_get (notmuch_filenames_t *filenames)\r
+ {\r
+-    if (filenames->iterator == NULL)\r
++    if ((filenames == NULL) || (filenames->iterator == NULL))\r
+       return NULL;\r
\r
+     return filenames->iterator->string;\r
+@@ -63,7 +63,7 @@ notmuch_filenames_get (notmuch_filenames_t *filenames)\r
+ void\r
+ notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)\r
+ {\r
+-    if (filenames->iterator == NULL)\r
++    if ((filenames == NULL) || (filenames->iterator == NULL))\r
+       return;\r
\r
+     filenames->iterator = filenames->iterator->next;\r
+-- \r
+1.7.10\r
+\r