mirror of
https://github.com/DaveGamble/cJSON.git
synced 2026-11-18 19:41:01 +00:00
ensure: Fix overflow detection
This commit is contained in:
1 parent
3c1bfe125c
commit
2683d4d987
1 file changed
+1
-1
@@ -276,7 +276,7 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* calculate new buffer size */
|
/* calculate new buffer size */
|
||||||
if (newsize > (INT_MAX / 2))
|
if (needed > (INT_MAX / 2))
|
||||||
{
|
{
|
||||||
/* overflow of int, use INT_MAX if possible */
|
/* overflow of int, use INT_MAX if possible */
|
||||||
if (needed <= INT_MAX)
|
if (needed <= INT_MAX)
|
||||||
|
|||||||
Reference in new issue
Block a user