[PATCH] avoid segfault when calling sanitize_string() on NULL

Subject: [PATCH] avoid segfault when calling sanitize_string() on NULL

Date: Tue, 10 May 2011 12:25:32 -0400

To: notmuch@notmuchmail.org

Cc:

From: Daniel Kahn Gillmor


---
 notmuch-search.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 794b145..26b24eb 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -116,6 +116,9 @@ sanitize_string (const void *ctx, const char *str)
 {
     char *out, *loop;
 
+    if (NULL == str)
+	return NULL;
+
     loop = out = talloc_strdup (ctx, str);
 
     for (; *loop; loop++) {
-- 
1.7.4.4


Thread: