From 37da1d2493d59122f7810650ce9d1c44215640b3 Mon Sep 17 00:00:00 2001 From: Dave Gamble Date: Fri, 6 Nov 2009 15:41:44 +0000 Subject: [PATCH] Fix for printing values that contain % literals. Thanks to Jimmy Tam! git-svn-id: http://svn.code.sf.net/p/cjson/code@11 e3330c51-1366-4df0-8b21-3ccf24e3d50e --- cJSON.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cJSON.c b/cJSON.c index cbec753..b200467 100644 --- a/cJSON.c +++ b/cJSON.c @@ -312,7 +312,7 @@ static char *print_array(cJSON *item,int depth) len+=strlen(ret)+3; out=(char*)cJSON_realloc(out,len); ptr=out+strlen(out); - ptr+=sprintf(ptr,ret); + ptr+=sprintf(ptr,"%s",ret); if (child->next) {*ptr++=',';*ptr++=' ';*ptr=0;} child=child->next; cJSON_free(ret); @@ -374,9 +374,9 @@ static char *print_object(cJSON *item,int depth) out=(char*)cJSON_realloc(out,len); ptr=out+strlen(out); for (i=0;inext) *ptr++=','; *ptr++='\n';*ptr=0; child=child->next;