mirror of
https://github.com/json-c/json-c.git
synced 2026-04-10 15:59:07 +08:00
Merge pull request #739 from rouault/avoid_unsigned_integer_overflow
json_escape_str(): avoid harmless unsigned integer overflow
This commit is contained in:
@@ -180,8 +180,9 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
|
|||||||
{
|
{
|
||||||
size_t pos = 0, start_offset = 0;
|
size_t pos = 0, start_offset = 0;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
while (len--)
|
while (len)
|
||||||
{
|
{
|
||||||
|
--len;
|
||||||
c = str[pos];
|
c = str[pos];
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user