From: David Edmondson Date: Tue, 6 Apr 2010 07:24:00 +0000 (+0100) Subject: json: Avoid calling strlen(NULL) X-Git-Tag: 0.3~147 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=cacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea json: Avoid calling strlen(NULL) MIME parts may have no filename, which previously resulted in calling strlen(NULL). --- diff --git a/json.c b/json.c index 1d0c1694..3fd923ca 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) + str = ""; + return (json_quote_chararray (ctx, str, strlen (str))); }