Browse Source
Merge pull request #739 from rouault/avoid_unsigned_integer_overflow
json_escape_str(): avoid harmless unsigned integer overflow
tags/json-c-0.16-20220414
Eric Hawicz
GitHub
3 years ago
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
1 deletions
-
json_object.c
|
|
|
@@ -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; |
|
|
|
unsigned char c; |
|
|
|
while (len--) |
|
|
|
while (len) |
|
|
|
{ |
|
|
|
--len; |
|
|
|
c = str[pos]; |
|
|
|
switch (c) |
|
|
|
{ |
|
|
|
|