mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 15:20:42 +01:00
json: fix pointer arithmetic error
Subtracting the pointers is sufficient for counting the tokens, they do not need to be modulus the size of jsmntok_t
This commit is contained in:
parent
0f5e8266cd
commit
1c1b63aae7
@ -82,7 +82,7 @@ static int find_object_tokens(struct json_iter *iter, jsmntok_t *object)
|
|||||||
if (!next)
|
if (!next)
|
||||||
next = ITER_END(iter);
|
next = ITER_END(iter);
|
||||||
|
|
||||||
return ((next - object) % sizeof(jsmntok_t)) - 1;
|
return next - object - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iter_recurse(struct json_iter *iter, jsmntok_t *object,
|
static void iter_recurse(struct json_iter *iter, jsmntok_t *object,
|
||||||
@ -91,7 +91,7 @@ static void iter_recurse(struct json_iter *iter, jsmntok_t *object,
|
|||||||
struct json_contents *c = iter->contents;
|
struct json_contents *c = iter->contents;
|
||||||
|
|
||||||
child->contents = c;
|
child->contents = c;
|
||||||
child->start = (object - c->tokens) % sizeof(jsmntok_t);
|
child->start = object - c->tokens;
|
||||||
child->count = find_object_tokens(iter, object);
|
child->count = find_object_tokens(iter, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user