Merge pull request #739 from rouault/avoid_unsigned_integer_overflow

json_escape_str(): avoid harmless unsigned integer overflow
This commit is contained in:
Eric Hawicz
2022-02-18 20:21:18 -05:00
committed by GitHub

View File

@@ -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)
{ {