Skip to content

Commit

Permalink
ensure: Fix overflow detection
Browse files Browse the repository at this point in the history
  • Loading branch information
FSMaxB committed Apr 5, 2017
1 parent 3c1bfe1 commit 2683d4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna
}

/* calculate new buffer size */
if (newsize > (INT_MAX / 2))
if (needed > (INT_MAX / 2))
{
/* overflow of int, use INT_MAX if possible */
if (needed <= INT_MAX)
Expand Down

0 comments on commit 2683d4d

Please sign in to comment.