summaryrefslogtreecommitdiff
path: root/json_pointer.c
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2018-03-25 18:25:58 -0400
committerEric Haszlakiewicz <erh+git@nimenees.com>2018-03-25 18:25:58 -0400
commitf8c632f579c71012f9aca81543b880a579f634fc (patch)
tree43fa8f638de2f6d287f4233f330a86df0a210e72 /json_pointer.c
parentda4b34355da023c439e96bc6ca31886cd69d6bdb (diff)
downloadjson-c-f8c632f579c71012f9aca81543b880a579f634fc.tar.gz
Issue #407: fix incorrect casts in calls to ctype functions (isdigit and isspace) so we don't crash when asserts are enabled on certain platforms and characters > 128 are parsed.
Diffstat (limited to 'json_pointer.c')
-rw-r--r--json_pointer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/json_pointer.c b/json_pointer.c
index 2b2a9ef..c7e34f7 100644
--- a/json_pointer.c
+++ b/json_pointer.c
@@ -44,7 +44,7 @@ static int is_valid_index(struct json_object *jo, const char *path, int32_t *idx
/* this code-path optimizes a bit, for when we reference the 0-9 index range in a JSON array
and because leading zeros not allowed */
if (len == 1) {
- if (isdigit((int)path[0])) {
+ if (isdigit((unsigned char)path[0])) {
*idx = (path[0] - '0');
goto check_oob;
}
@@ -58,7 +58,7 @@ static int is_valid_index(struct json_object *jo, const char *path, int32_t *idx
}
/* RFC states base-10 decimals */
for (i = 0; i < len; i++) {
- if (!isdigit((int)path[i])) {
+ if (!isdigit((unsigned char)path[i])) {
errno = EINVAL;
return 0;
}