1
0
mirror of https://github.com/DaveGamble/cJSON synced 2024-12-25 08:02:03 +00:00

ensure: Validate buffer offset

This commit is contained in:
Max Bruckner 2017-03-23 21:35:24 +01:00
parent cc84a446be
commit 1934059554

View File

@ -253,6 +253,12 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
return NULL;
}
if ((p->length > 0) && (p->offset >= p->length))
{
/* make sure that offset is valid */
return NULL;
}
if (needed > INT_MAX)
{
/* sizes bigger than INT_MAX are currently not supported */