461 Commits

Author SHA1 Message Date
Nicolas Badoux
12c4bf1986 Wrong counter increment 2024-09-23 19:08:58 +08:00
Nicolas Badoux
9d1b229086 Added max recusrion depth for cJSONDuplicate to prevent stack exhaustion in case of circular reference 2024-09-23 19:08:58 +08:00
Nicolas Badoux
d6d5449e1f fix #881, check overlap before calling strcpy in cJSON_SetValuestring 2024-08-30 11:29:28 +08:00
Nicolas Badoux
a78d975537 cJSON_DetachItemViaPointer: added test and fix for check for null in item->prev 2024-08-30 11:29:05 +08:00
Nicolas Badoux
f28a468e3b Check for NULL in cJSON_DetachItemViaPointer 2024-08-30 11:29:05 +08:00
DL6ER
8a334b0140 Fix indentation (should use spaces)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-05-14 09:42:46 +08:00
Alanscut
76be8fcf15 Release 1.7.18 2024-05-13 18:26:15 +08:00
maebex
542fb0eadd Set free'd pointers to NULL whenever they are not reassigned immediately after 2024-05-13 17:18:46 +08:00
orri
3ef4e4e730 Fix heap buffer overflow
Fixes #800
2024-05-06 11:33:33 +08:00
Alanscut
19396a49a6 update comments and add tests for cJSON_SetValuestring 2024-04-29 10:01:35 +08:00
Up-wind
7e4d5dabe7 Add NULL check to cJSON_SetValuestring()
If the valuestring passed to cJSON_SetValuestring is NULL, a null pointer dereference will happen.

This commit adds the NULL check of valuestring before it is dereferenced.
2024-04-26 16:34:05 +08:00
Alanscut
87d8f0961a Release 1.7.17
update version to 1.7.17
2023-12-26 10:24:36 +08:00
Lee
f66cbab4bf
fix error in null checkings (#810)
fixes #802 and #803
2023-12-20 11:05:23 +08:00
Lee
60ff122ef5
add NULL checkings (#809)
* add NULL checks in cJSON_SetValuestring

Fixes #803(CVE-2023-50472)

* add NULL check in cJSON_InsertItemInArray

Fixes #802(CVE-2023-50471)

* add tests for NULL checks

add tests for NULL checks in cJSON_InsertItemInArray and cJSON_SetValuestring
2023-12-18 11:47:52 +08:00
Alan Wang
cb8693b058
Release 1.7.16 (#770)
* Update version to 1.7.16

* Update contributors
2023-07-05 11:22:19 +08:00
hopper-vul
766dd9d590
Fix a null pointer crash in cJSON_ReplaceItemViaPointer (#726)
If the parent passed in cJSON_ReplaceItemViaPointer has not a child, which means parent->child is null, a null pointer dereference crash will be happened inside cJSON_ReplaceItemViaPointer.

This commit adds the NULL check of `parent->child` beforehand to inform user such incorrect usage.

Signed-off-by: hopper-vul <hopper.vul@gmail.com>
2023-07-01 16:18:32 +08:00
Junbo Zheng
b45f48e600
fix: add allocate check for replace_item_in_object (#675)
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2022-03-29 15:02:59 +08:00
AlexanderVasiljev
d321fa9e6e
fix: print int without decimal places (#630) 2022-01-19 10:30:31 +08:00
Alan Wang
d348621ca9
chore: update version and changelog (#610) 2021-08-25 19:15:09 +08:00
Alan Wang
744e47353a
fix: remove redundant condition (#605) 2021-08-25 15:02:00 +08:00
Jordan IMBERT
9226e4ed8c
Remove always true condition in cJSON.c (#539) 2020-12-17 17:07:18 +08:00
Alan Wang
7b6645794d
Fix null pointer crash, closes #536 (#538) 2020-12-17 15:42:31 +08:00
mongobaba
2f6fc7f0f2
fix several null pointer problems on allocation failure (#526) 2020-11-12 11:46:15 +08:00
Use
9931900768 fix: windows build failure about defining nan 2020-10-15 11:52:06 +09:00
Alanscut
8e357f825b Update version to 1.7.14 2020-09-03 17:07:49 +08:00
Alanscut
c8ca78a3cc optimize the way to find tail node 2020-09-02 20:23:52 +08:00
Kevin Sapper
4578d3a9e1 Problem: WError error on macosx because NAN is a float
Solution: Add explicit cast from NAN to double
2020-06-23 09:17:32 +02:00
Alanscut
b95a4c56b0 fix #376 2020-06-22 11:23:24 +08:00
miaoerduo
cb4661cd91 fix: errors in replacing the first item when array_size is 1, and replacing the last item 2020-04-03 17:21:02 +08:00
miaoerduo
a65abf2f4f fix: error list head's prev when detach the last item 2020-04-03 17:20:57 +08:00
miaoerduo
3999b12848 feat: set list head's prev in parse_array and parse_object 2020-04-03 17:20:42 +08:00
Alanscut
ff0dabc72e Update version to 1.7.13 2020-04-02 23:34:28 +08:00
Alanscut
5d55c6c2ee fix error C2124 in visual studio 2020-04-02 23:32:30 +08:00
Alan Wang
23e4fbc639
Merge pull request #454 from Alanscut/float-compare
comparing double value with DBL_EPSILON
2020-04-02 20:09:42 +08:00
Alan Wang
65578af8cc
Merge pull request #453 from Alanscut/add-return-value
add return value for  cJSON_AddItemTo... and cJSON_ReplaceItemxxx
2020-04-02 19:41:56 +08:00
Alan Wang
f12cd7b701
Merge pull request #451 from Alanscut/20200324
add new function of `cJSON_SetValuestring`
2020-04-02 19:40:03 +08:00
Sang-Heon Jeon
97cf1d84e4 Add getNumberValue function
* Add GetNumberValue function and testcase

Co-authored-by: Alan Wang <wp_scut@163.com>
2020-04-02 19:36:35 +08:00
caglarivriz
983bb2b4d6 Added cJSON_ParseWithLength (#358)
Co-authored-by: Caglar Ivriz <caglar.ivriz@siemens.com>
2020-04-02 19:24:36 +08:00
Alanscut
8943c73345 comparing double value with DBL_EPSILON 2020-04-02 16:02:24 +08:00
Alanscut
131966f748 add return value for cJSON_ReplaceItemxxx 2020-04-02 11:00:10 +08:00
Alanscut
bd7cbe9776 false has been redefined to cJSON_False 2020-04-01 19:19:00 +08:00
Alanscut
54d6b8016e add return value for cJSON_AddItemTo... 2020-03-26 14:18:52 +08:00
Alanscut
31c7880fab update cJSON_SetValuestring and testcase 2020-03-25 15:38:54 +08:00
Alanscut
6b35f1c5bc add new function of setValuestringToObject 2020-03-24 22:28:15 +08:00
Alan Wang
3ece4c893c
Improve performance of adding item to array (#448)
* use prev pointer when adding item to array

Co-authored-by: xiaomianhehe <hongshaokai@hotmail.com>
Co-authored-by: Alanscut <scut@163.com>

Date:   Tue Feb 18 11:54:23 2020 +0800

* add testcase for cJSON_DeleteItemFromArray
2020-03-24 16:17:25 +08:00
Alan Wang
9034a9cd0b Revert "use prev pointer when array do adding (#430)"
This reverts commit e8077d01500279a7b45b8cd7a0ae94ea7ad5748a.
2020-03-16 23:04:39 +08:00
xiaomianhehe
e8077d0150
use prev pointer when array do adding (#430)
* use prev pointer when array do adding
2020-02-18 11:54:23 +08:00
Alanscut
74b2f03837 remove annoying float-equal option 2020-01-18 23:18:19 +08:00
Alanscut
c06d8264d0 improve compare_double function 2019-12-06 18:16:27 +08:00
Alanscut
51f6b4c07e
Merge branch 'master' into master 2019-12-06 15:14:26 +08:00