Browse Source

Merge pull request #694 from ihsinme/patch-1

fix invalid unsigned arithmetic.
tags/json-c-0.16-20220414
Eric Hawicz GitHub 4 years ago
parent
commit
7c859c54e4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      json_object.c

+ 3
- 3
json_object.c View File

@@ -235,7 +235,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
break;
}

if (pos - start_offset > 0)
if (pos > start_offset)
printbuf_memappend(pb, str + start_offset, pos - start_offset);

if (c == '\b')
@@ -261,7 +261,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
if (c < ' ')
{
char sbuf[7];
if (pos - start_offset > 0)
if (pos > start_offset)
printbuf_memappend(pb, str + start_offset,
pos - start_offset);
snprintf(sbuf, sizeof(sbuf), "\\u00%c%c", json_hex_chars[c >> 4],
@@ -273,7 +273,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, size_t len, int
pos++;
}
}
if (pos - start_offset > 0)
if (pos > start_offset)
printbuf_memappend(pb, str + start_offset, pos - start_offset);
return 0;
}


Loading…
Cancel
Save