aboutsummaryrefslogtreecommitdiffhomepage
path: root/json.c
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2010-04-06 08:24:00 +0100
committerGravatar Carl Worth <cworth@cworth.org>2010-04-20 08:54:51 -0700
commitcacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea (patch)
treeecc3a9d0346b55071cfa414ad27e35ca1511c13d /json.c
parentcdd64727f197bf9e24b89da768d75bf268b8fb1c (diff)
json: Avoid calling strlen(NULL)
MIME parts may have no filename, which previously resulted in calling strlen(NULL).
Diffstat (limited to 'json.c')
-rw-r--r--json.c3
1 files changed, 3 insertions, 0 deletions
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)));
}