mirror of
https://github.com/json-c/json-c.git
synced 2026-04-08 14:59:06 +08:00
json_object_deep_copy: fix deep copy of strings containing '\0'
This commit is contained in:
@@ -1388,7 +1388,7 @@ int json_c_shallow_copy_default(json_object *src, json_object *parent, const cha
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case json_type_string:
|
case json_type_string:
|
||||||
*dst = json_object_new_string(get_string_component(src));
|
*dst = json_object_new_string_len(get_string_component(src), src->o.c_string.len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case json_type_object:
|
case json_type_object:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ static const char *json_str1 =
|
|||||||
" \"GlossDiv\": {"
|
" \"GlossDiv\": {"
|
||||||
" \"title\": \"S\","
|
" \"title\": \"S\","
|
||||||
" \"null_obj\": null, "
|
" \"null_obj\": null, "
|
||||||
|
" \"null_str\": \" \\u0000 \","
|
||||||
" \"GlossList\": {"
|
" \"GlossList\": {"
|
||||||
" \"GlossEntry\": {"
|
" \"GlossEntry\": {"
|
||||||
" \"ID\": \"SGML\","
|
" \"ID\": \"SGML\","
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Printing JSON objects for visual inspection
|
|||||||
"GlossDiv":{
|
"GlossDiv":{
|
||||||
"title":"S",
|
"title":"S",
|
||||||
"null_obj":null,
|
"null_obj":null,
|
||||||
|
"null_str":" \u0000 ",
|
||||||
"GlossList":{
|
"GlossList":{
|
||||||
"GlossEntry":{
|
"GlossEntry":{
|
||||||
"ID":"SGML",
|
"ID":"SGML",
|
||||||
|
|||||||
Reference in New Issue
Block a user