[PATCH] avoid segfault when calling sanitize_string() on NULL
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 10 May 2011 16:25:32 +0000 (12:25 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:13 +0000 (09:38 -0800)
4c/c280a80e30e6ee7130f6149cb4d3a4ca87daf3 [new file with mode: 0644]

diff --git a/4c/c280a80e30e6ee7130f6149cb4d3a4ca87daf3 b/4c/c280a80e30e6ee7130f6149cb4d3a4ca87daf3
new file mode 100644 (file)
index 0000000..9d0c3ea
--- /dev/null
@@ -0,0 +1,65 @@
+Return-Path: <dkg@fifthhorseman.net>\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 84285429E29\r
+       for <notmuch@notmuchmail.org>; Tue, 10 May 2011 09:25:42 -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 gn6vu536LEhu for <notmuch@notmuchmail.org>;\r
+       Tue, 10 May 2011 09:25:42 -0700 (PDT)\r
+Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0CCAF429E27\r
+       for <notmuch@notmuchmail.org>; Tue, 10 May 2011 09:25:42 -0700 (PDT)\r
+Received: from pip.fifthhorseman.net (lair.fifthhorseman.net\r
+ [216.254.116.241])    by che.mayfirst.org (Postfix) with ESMTPSA id 5EFE1F970;\r
+       Tue, 10 May 2011 12:25:39 -0400 (EDT)\r
+Received: by pip.fifthhorseman.net (Postfix, from userid 1000)\r
+       id EF62D11883; Tue, 10 May 2011 12:25:33 -0400 (EDT)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] avoid segfault when calling sanitize_string() on NULL\r
+Date: Tue, 10 May 2011 12:25:32 -0400\r
+Message-Id: <1305044732-13882-1-git-send-email-dkg@fifthhorseman.net>\r
+X-Mailer: git-send-email 1.7.4.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\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: Tue, 10 May 2011 16:25:42 -0000\r
+\r
+---\r
+ notmuch-search.c |    3 +++\r
+ 1 files changed, 3 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 794b145..26b24eb 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str)\r
+ {\r
+     char *out, *loop;\r
\r
++    if (NULL == str)\r
++      return NULL;\r
++\r
+     loop = out = talloc_strdup (ctx, str);\r
\r
+     for (; *loop; loop++) {\r
+-- \r
+1.7.4.4\r
+\r