Skip to content

Commit 66cce0a

Browse files
authored
Merge pull request json-c#739 from rouault/avoid_unsigned_integer_overflow
json_escape_str(): avoid harmless unsigned integer overflow
2 parents b11f79c + 296db61 commit 66cce0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: json_object.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
180180
{
181181
size_t pos = 0, start_offset = 0;
182182
unsigned char c;
183-
while (len--)
183+
while (len)
184184
{
185+
--len;
185186
c = str[pos];
186187
switch (c)
187188
{

0 commit comments

Comments
 (0)