--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 1CA35431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 8 Aug 2012 14:28:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 erSxp7q8C250 for <notmuch@notmuchmail.org>;\r
+ Wed, 8 Aug 2012 14:28:51 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
+ [18.7.68.37])\r
+ by olra.theworths.org (Postfix) with ESMTP id 54A10431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 8 Aug 2012 14:28:51 -0700 (PDT)\r
+X-AuditID: 12074425-b7f9b6d0000008c4-23-5022da12613e\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 5F.5D.02244.21AD2205; Wed, 8 Aug 2012 17:28:50 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q78LSoQ3018316; \r
+ Wed, 8 Aug 2012 17:28:50 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q78LSmJ1017281\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Wed, 8 Aug 2012 17:28:49 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1SzDo8-0007I1-Ok; Wed, 08 Aug 2012 17:28:48 -0400\r
+Date: Wed, 8 Aug 2012 17:28:48 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH] sprinters: bugfix when NULL passed for a string.\r
+Message-ID: <20120808212848.GF11179@mit.edu>\r
+References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>\r
+ <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
+ <87mx25ulgq.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87mx25ulgq.fsf@qmul.ac.uk>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IR4hTV1hW6pRRgsOKLnsXquTwW12/OZHZg\r
+ 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MnZfO8NSMFWy4uCDPcwNjNuEuxg5OSQETCSW\r
+ Na1lhbDFJC7cW8/WxcjFISSwj1Fiw+QrzBDOekaJjQvOs0A4J5gkFnzoYodwljBK7L94mx2k\r
+ n0VARWLn6wlsIDabgIbEtv3LGUFsEQEdiduHFoDVMAtIS3z73cwEYgsLuErc2vMVbDcvUM2s\r
+ 9+sZIYZOYZTofDKPDSIhKHFy5hMWiGYtiRv/XgI1c4ANWv6PA8TkBNp1oNkIpEIU6IQpJ7ex\r
+ TWAUmoWkeRaS5lkIzQsYmVcxyqbkVunmJmbmFKcm6xYnJ+blpRbpWujlZpbopaaUbmIEhTW7\r
+ i+oOxgmHlA4xCnAwKvHwam1QChBiTSwrrsw9xCjJwaQkyrvoIlCILyk/pTIjsTgjvqg0J7X4\r
+ EKMEB7OSCG/1NqAcb0piZVVqUT5MSpqDRUmc90bKTX8hgfTEktTs1NSC1CKYrAwHh5IEr+5N\r
+ oEbBotT01Iq0zJwShDQTByfIcB6g4fYgNbzFBYm5xZnpEPlTjLoc958/uc0oxJKXn5cqJc6r\r
+ A1IkAFKUUZoHNweWjl4xigO9JcwbBFLFA0xlcJNeAS1hAlpyWBRsSUkiQkqqgfGC883egz/+\r
+ GUma8bS0blz17XSHp0NYMEtcMP/HgoXFhotf6jxNTlhTFNP6/bwXC+cSRV/Dslm/v/AG1de9\r
+ utBSfsC54afcmgY2b8kDDzfpCrlwGE17/7aseeoPmzkHNi1+t1vl1SUOv2/qB2+tOD/5m4WS\r
+ lVC12k2TrU2Gu5M8MyrUpIWfcCuxFGckGmoxFxUnAgDf6r5dIgMAAA==\r
+Cc: notmuch@notmuchmail.org\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: Wed, 08 Aug 2012 21:28:52 -0000\r
+\r
+LGTM!\r
+\r
+Quoth Mark Walters on Aug 08 at 10:23 pm:\r
+> \r
+> The string function in a sprinter may be called with a NULL string\r
+> pointer (eg if a header is absent). This causes a segfault. We fix\r
+> this by checking for a null pointer in the string functions and update\r
+> the sprinter documentation.\r
+> \r
+> At the moment some output when format=text is done directly rather than\r
+> via an sprinter: in that case a null pointer is passed to printf or\r
+> similar and a "(null)" appears in the output. That behaviour is not\r
+> changed in this patch.\r
+> ---\r
+> \r
+> This is the same as id:"874noe1o0r.fsf@qmul.ac.uk" except for being\r
+> based on top of the test in the parent message, and marking the broken\r
+> test fixed.\r
+> \r
+> Best wishes\r
+> \r
+> Mark\r
+> \r
+> sprinter-json.c | 2 ++\r
+> sprinter-text.c | 2 ++\r
+> sprinter.h | 4 +++-\r
+> test/missing-headers | 2 --\r
+> 4 files changed, 7 insertions(+), 3 deletions(-)\r
+> \r
+> diff --git a/sprinter-json.c b/sprinter-json.c\r
+> index c9b6835..0a07790 100644\r
+> --- a/sprinter-json.c\r
+> +++ b/sprinter-json.c\r
+> @@ -118,6 +118,8 @@ json_string_len (struct sprinter *sp, const char *val, size_t len)\r
+> static void\r
+> json_string (struct sprinter *sp, const char *val)\r
+> {\r
+> + if (val == NULL)\r
+> + val = "";\r
+> json_string_len (sp, val, strlen (val));\r
+> }\r
+> \r
+> diff --git a/sprinter-text.c b/sprinter-text.c\r
+> index dfa54b5..10343be 100644\r
+> --- a/sprinter-text.c\r
+> +++ b/sprinter-text.c\r
+> @@ -38,6 +38,8 @@ text_string_len (struct sprinter *sp, const char *val, size_t len)\r
+> static void\r
+> text_string (struct sprinter *sp, const char *val)\r
+> {\r
+> + if (val == NULL)\r
+> + val = "";\r
+> text_string_len (sp, val, strlen (val));\r
+> }\r
+> \r
+> diff --git a/sprinter.h b/sprinter.h\r
+> index 5f43175..912a526 100644\r
+> --- a/sprinter.h\r
+> +++ b/sprinter.h\r
+> @@ -27,7 +27,9 @@ typedef struct sprinter {\r
+> * a list or map, followed or preceded by separators). For string\r
+> * and string_len, the char * must be UTF-8 encoded. string_len\r
+> * allows non-terminated strings and strings with embedded NULs\r
+> - * (though the handling of the latter is format-dependent).\r
+> + * (though the handling of the latter is format-dependent). For\r
+> + * string (but not string_len) the string pointer passed may be\r
+> + * NULL.\r
+> */\r
+> void (*string) (struct sprinter *, const char *);\r
+> void (*string_len) (struct sprinter *, const char *, size_t);\r
+> diff --git a/test/missing-headers b/test/missing-headers\r
+> index e79f922..f14b878 100755\r
+> --- a/test/missing-headers\r
+> +++ b/test/missing-headers\r
+> @@ -29,7 +29,6 @@ thread:XXX 2001-01-05 [1/1] (null); (inbox unread)\r
+> thread:XXX 1970-01-01 [1/1] Notmuch Test Suite; (inbox unread)"\r
+> \r
+> test_begin_subtest "Search: json"\r
+> -test_subtest_known_broken\r
+> output=$(notmuch search --format=json '*' | notmuch_search_sanitize)\r
+> test_expect_equal_json "$output" '\r
+> [\r
+> @@ -93,7 +92,6 @@ Body\r
+> \f\r
+message}"\r
+> \r
+> test_begin_subtest "Show: json"\r
+> -test_subtest_known_broken\r
+> output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)\r
+> test_expect_equal_json "$output" '\r
+> [\r