From cacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Tue, 6 Apr 2010 08:24:00 +0100 Subject: [PATCH] json: Avoid calling strlen(NULL) MIME parts may have no filename, which previously resulted in calling strlen(NULL). --- json.c | 3 +++ 1 file changed, 3 insertions(+) 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))); } -- 2.26.2