]> git.feebdaed.xyz Git - 0xmirror/cJSON.git/commitdiff
Wrong counter increment
authorNicolas Badoux <n.badoux@hotmail.com>
Fri, 30 Aug 2024 13:09:28 +0000 (15:09 +0200)
committerAlan Wang <wp_scut@163.com>
Mon, 23 Sep 2024 11:08:58 +0000 (19:08 +0800)
cJSON.c

diff --git a/cJSON.c b/cJSON.c
index 9399c0ddeeed7b7e2051a8e76aeee75783eda36e..d7c72363db4a3608baadb640961a1ac95c7d5fba 100644 (file)
--- a/cJSON.c
+++ b/cJSON.c
@@ -2794,7 +2794,7 @@ cJSON * cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse)
         if(depth >= CJSON_CIRCULAR_LIMIT) {
             goto fail;
         }
-        newchild = cJSON_Duplicate_rec(child, ++depth, true); /* Duplicate (with recurse) each item in the ->next chain */
+        newchild = cJSON_Duplicate_rec(child, depth + 1, true); /* Duplicate (with recurse) each item in the ->next chain */
         if (!newchild)
         {
             goto fail;