From 6a7fe5411f6906cb4298af7cc445f2860450ea67 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Jun 2012 09:24:42 -0500 Subject: [PATCH] FS-4285 --resolve --- src/switch_json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_json.c b/src/switch_json.c index 83b34704e6..4bef601f8e 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -50,10 +50,11 @@ static char* cJSON_strdup(const char* str) { size_t len; char* copy; + const char *s = str ? str : ""; - len = strlen(str) + 1; + len = strlen(s) + 1; if (!(copy = (char*)cJSON_malloc(len))) return 0; - memcpy(copy,str,len); + memcpy(copy,s,len); return copy; }