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

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

Date: Sat, 28 May 2011 14:51:52 -0700

To: Notmuch Mail

Cc: Daniel Kahn Gillmor

From: Jameson Graef Rollins


From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
---
 notmuch-search.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 530cecc..616fe68 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: