mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
ensure: Validate buffer offset
This commit is contained in:
6
cJSON.c
6
cJSON.c
@@ -253,6 +253,12 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((p->length > 0) && (p->offset >= p->length))
|
||||||
|
{
|
||||||
|
/* make sure that offset is valid */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (needed > INT_MAX)
|
if (needed > INT_MAX)
|
||||||
{
|
{
|
||||||
/* sizes bigger than INT_MAX are currently not supported */
|
/* sizes bigger than INT_MAX are currently not supported */
|
||||||
|
|||||||
Reference in New Issue
Block a user