summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Hawicz <erh+git@nimenees.com>2021-02-06 17:25:24 -0500
committerGitHub <noreply@github.com>2021-02-06 17:25:24 -0500
commit7c859c54e490a2ac8d5971242e726325ae377557 (patch)
tree3b92b9b1978dddbe6ca5ecf92dbbd1a8793a718a
parent0f61f6921b2e4395d1e354ad356137e44d6a7e11 (diff)
parentc456963110fa5af9a209218c718d81033ad53669 (diff)
downloadjson-c-7c859c54e490a2ac8d5971242e726325ae377557.tar.gz
Merge pull request #694 from ihsinme/patch-1
fix invalid unsigned arithmetic.
-rw-r--r--json_object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/json_object.c b/json_object.c
index b42026b..c15a477 100644
--- a/json_object.c
+++ b/json_object.c
@@ -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;
}