Compare commits

...

3 Commits

Author SHA1 Message Date
Zhao Zhixu c87a22aec9
Merge 5da11d6bea into 87d8f0961a 2024-02-13 21:40:19 +04:00
Alanscut 87d8f0961a Release 1.7.17
update version to 1.7.17
2023-12-26 10:24:36 +08:00
Zhixu Zhao 5da11d6bea Support creating empty arrays with cJSON_Create*Array(). 2021-12-14 00:05:39 +08:00
5 changed files with 15 additions and 8 deletions

View File

@ -1,3 +1,10 @@
1.7.17 (Dec 26, 2023)
======
Fixes:
------
* Fix null reference in cJSON_SetValuestring(CVE-2023-50472), see #809
* Fix null reference in cJSON_InsertItemInArray(CVE-2023-50471), see #809 and #810
1.7.16 (Jul 5, 2023)
======
Features:

View File

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

View File

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

10
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 != 16)
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 17)
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
#endif
@ -2559,7 +2559,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count)
cJSON *p = NULL;
cJSON *a = NULL;
if ((count < 0) || (numbers == NULL))
if ((count < 0) || ((count > 0) && (numbers == NULL)))
{
return NULL;
}
@ -2599,7 +2599,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count)
cJSON *p = NULL;
cJSON *a = NULL;
if ((count < 0) || (numbers == NULL))
if ((count < 0) || ((count > 0) && (numbers == NULL)))
{
return NULL;
}
@ -2639,7 +2639,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
cJSON *p = NULL;
cJSON *a = NULL;
if ((count < 0) || (numbers == NULL))
if ((count < 0) || ((count > 0) && (numbers == NULL)))
{
return NULL;
}
@ -2679,7 +2679,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int co
cJSON *p = NULL;
cJSON *a = NULL;
if ((count < 0) || (strings == NULL))
if ((count < 0) || ((count > 0) && (strings == NULL)))
{
return NULL;
}

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 16
#define CJSON_VERSION_PATCH 17
#include <stddef.h>