json: Avoid calling strlen(NULL)

MIME parts may have no filename, which previously resulted in calling
strlen(NULL).
This commit is contained in:
David Edmondson 2010-04-06 08:24:00 +01:00 committed by Carl Worth
parent cdd64727f1
commit cacefbf3d6

3
json.c
View file

@ -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)));
}