From 34800dc0191a4ee7a329eeb361a6f2ccf4a75176 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 23 Mar 2021 18:05:44 +0100 Subject: [PATCH] json: don't move past the end of a symbol We can't move past the } or ] or we might miss the end of the container. Now that we ignore \0 it is not a problem if the \0 is placed at the container boundary. --- spa/include/spa/utils/json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/include/spa/utils/json.h b/spa/include/spa/utils/json.h index 99f32d4d4..e6f599d84 100644 --- a/spa/include/spa/utils/json.h +++ b/spa/include/spa/utils/json.h @@ -112,7 +112,7 @@ static inline int spa_json_next(struct spa_json * iter, const char **value) iter->state = __STRUCT; if (iter->depth > 0) goto again; - return iter->cur++ - *value; + return iter->cur - *value; } continue; case __STRING: