Compare commits

...

3 Commits

Author SHA1 Message Date
Intector
50ccf631bb
Merge 975c65c33f into c859b25da0 2025-09-09 17:44:01 +02:00
Alan Wang
c859b25da0
Release 1.7.19 (#958)
Some checks failed
CI / linux (CLANG, ENABLE_SANITIZERS) (push) Has been cancelled
CI / linux (CLANG, ENABLE_VALGRIND) (push) Has been cancelled
CI / linux (CLANG, NONE_MEM_CHECK) (push) Has been cancelled
CI / linux (GCC, ENABLE_SANITIZERS) (push) Has been cancelled
CI / linux (GCC, ENABLE_VALGRIND) (push) Has been cancelled
CI / linux (GCC, NONE_MEM_CHECK) (push) Has been cancelled
CI / macos (CLANG, ENABLE_SANITIZERS) (push) Has been cancelled
CI / macos (CLANG, ENABLE_VALGRIND) (push) Has been cancelled
CI / macos (CLANG, NONE_MEM_CHECK) (push) Has been cancelled
CI / macos (GCC, ENABLE_SANITIZERS) (push) Has been cancelled
CI / macos (GCC, ENABLE_VALGRIND) (push) Has been cancelled
CI / macos (GCC, NONE_MEM_CHECK) (push) Has been cancelled
2025-09-09 21:56:10 +08:00
Intector
975c65c33f Update static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) in cJSON.c
changes to the function:
static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer)

The function: strcpy((char*)output, "false") causes memory crashes in ThreadX(at least in my case). The modification delivers the same results, but without the crash.
2025-04-02 07:24:00 -05:00
6 changed files with 47 additions and 7 deletions

View File

@ -1,3 +1,15 @@
1.7.19 (Sep 9, 2025)
======
Fixes:
------
* Fix indentation (should use spaces), see #814
* Fix spelling errors found by CodeSpell, see #841
* Check for NULL in cJSON_DetachItemViaPointer, fixes #882, see #886
* Fix #881, check overlap before calling strcpy in cJSON_SetValuestring, see #885
* Fix #880 Max recursion depth for cJSON_Duplicate to prevent stack exhaustion, see #888
* Allocate memory for the temporary buffer when paring numbers, see #939
* fix the incorrect check in decode_array_index_from_pointer, see #957
1.7.18 (May 13, 2024)
======
Fixes:

View File

@ -2,7 +2,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 3.0)
project(cJSON
VERSION 1.7.18
VERSION 1.7.19
LANGUAGES C)
cmake_policy(SET CMP0054 NEW) # set CMP0054 policy

View File

@ -24,6 +24,7 @@ Contributors:
* [Debora Grosse](https://github.com/DeboraG)
* [dieyushi](https://github.com/dieyushi)
* [Dōngwén Huáng (黄东文)](https://github.com/DongwenHuang)
* [Dominik](https://github.com/DL6ER)
* [Donough Liu](https://github.com/ldm0)
* [Erez Oxman](https://github.com/erez-o)
* Eswar Yaganti
@ -80,6 +81,8 @@ Contributors:
* [Stephan Gatzka](https://github.com/gatzka)
* [Tony Langhammer](https://github.com/BigBrainAFK)
* [Vemake](https://github.com/vemakereporter)
* [vwvw](https://github.com/vwvw)
* [warmsocks](https://github.com/warmsocks)
* [Wei Tan](https://github.com/tan-wei)
* [Weston Schmidt](https://github.com/schmidtw)
* [xiaomianhehe](https://github.com/xiaomianhehe)

View File

@ -8,7 +8,7 @@ CJSON_TEST_SRC = cJSON.c test.c
LDLIBS = -lm
LIBVERSION = 1.7.18
LIBVERSION = 1.7.19
CJSON_SOVERSION = 1
UTILS_SOVERSION = 1

33
cJSON.c
View File

@ -117,7 +117,7 @@ CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item)
}
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 18)
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 19)
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
#endif
@ -1432,7 +1432,15 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp
{
return false;
}
strcpy((char*)output, "null");
//
// this modifications are made because the strcpy does not work in some cases
*output++ = 'n';
*output++ = 'u';
*output++ = 'l';
*output++ = 'l';
*output = '\0';
// this does not work
//strcpy((char*)output, "null");
return true;
case cJSON_False:
@ -1441,7 +1449,16 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp
{
return false;
}
strcpy((char*)output, "false");
//
// this modifications are made because the strcpy does not work in some cases
*output++ = 'f';
*output++ = 'a';
*output++ = 'l';
*output++ = 's';
*output++ = 'e';
*output = '\0';
// this does not work
//strcpy((char*)output, "false");
return true;
case cJSON_True:
@ -1450,7 +1467,15 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp
{
return false;
}
strcpy((char*)output, "true");
//
// this modifications are made because the strcpy does not work in some cases
*output++ = 't';
*output++ = 'r';
*output++ = 'u';
*output++ = 'e';
*output = '\0';
// this does not work
//strcpy((char*)output, "true");
return true;
case cJSON_Number:

View File

@ -81,7 +81,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 7
#define CJSON_VERSION_PATCH 18
#define CJSON_VERSION_PATCH 19
#include <stddef.h>