unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] json: Avoid calling strlen(NULL)
@ 2010-04-06  7:25 David Edmondson
  2010-04-06  8:17 ` Anthony Towns
  0 siblings, 1 reply; 4+ messages in thread
From: David Edmondson @ 2010-04-06  7:25 UTC (permalink / raw)
  To: notmuch

commit b65817262b3a275ecd0ef1898d92ec5508a9f810
Author: David Edmondson <dme@dme.org>
Date:   Tue Apr 6 08:24:00 2010 +0100

    json: Avoid calling strlen(NULL)
    
    MIME parts may have no filename, which previously resulted in calling
    strlen(NULL).

	Modified json.c
diff --git a/json.c b/json.c
index f90b0fa..b73f22a 100644
--- a/json.c
+++ b/json.c
@@ -105,5 +105,8 @@ json_quote_chararray(const void *ctx, const char *str, const size_t len)
 char *
 json_quote_str(const void *ctx, const char *str)
 {
+    if (str == NULL)
+	return (char *)"\"\"";
+
     return (json_quote_chararray (ctx, str, strlen (str)));
 }


dme.
-- 
David Edmondson, http://dme.org

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-20 15:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06  7:25 [PATCH] json: Avoid calling strlen(NULL) David Edmondson
2010-04-06  8:17 ` Anthony Towns
2010-04-06  8:31   ` David Edmondson
2010-04-20 15:59   ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).